Finding out which files are being used by a process under Linux

I needed to find out which files a process was using. I used the following commands to do this.

The ps command to get the process id (PID) of the process.

$ ps -aef | grep

Then the lsof command to list the files being used by the process.

$ lsof -p

If you want to count the files being used, use the following command.

$ lsof -p  | wc -l

Have fun.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s