Tuesday, September 6, 2016

lsof

Checking for Open Files

lsof

You can use the lsof command at the shell prompt to display a list of open files. Entering lsof at the shell prompt without any options lists all open files belonging to all active processes on the system. Useful options you can use with lsof include the following:

 -s:  Displays file sizes.

 -t:  Specifies that lsof should produce terse output with process identifiers only and no header. This is useful if you are piping the output of lsof to the kill command.

 -u <user_name>:  Displays only open files associated with the specified user.


In the next example, a list of open files associated with the tux user on the system are displayed by lsof:

openSUSE:/sbin # lsof -u tux | more

>lsof -s

>lsof -t|kill 

>lsof -u kenmsipe

No comments:

Post a Comment