How to monitor file access in linux (ubuntu 14.04)

linux
Published

September 2, 2019

On my computer, the hard drive is the limiting factor for the overall speed/reaction of the OS. If a process is accessing a lot the hard drive, Gnome Shell starts to be really unresponsive.

To know which process is accessing your hard drive, use iotop in a terminal.

sudo iotop

iotop works the same way than top, but it shows the percentage of use of the hard drive per process, so you can know which process is hanging your computer/server and its PID (first column). Push q key to exit.

If you want to know which files are opened by the process, use strace. If the pid of your process is 1234, use the following:

sudo strace -e open -p 1234

(the “-e open” is used to show only the file operations, otherwise you will have too much information to be able to follow it in real time). Ctrl + C to exit.