Wednesday, February 4, 2009

How to get open file information on Linux

Here is a small command line util that I have used many times. It will show a list of open files on a linux system. I have used this command to check for things like open ftp connections, large file copies and even database files open.

To get a list of open files on the system

Log in as root then type the following at a command prompt
To get a count of the number of open files
lsof | wc -l
To search for a particular file you can add grep to the command
lsof | grep filetoseachfor.txt

No comments: