Tuesday, May 13, 2008

List number of file handles (open files) for each process

Here is a simple script that will show you a number of file handles (open files) used by each process on your Linux system:


ps -e|grep -v TTY|awk {'print "echo -n \"Process: "$4"\tPID: "$1"\tNumber of FH: \"; lsof -p "$1"|wc -l"'} > out; . ./out

2 comments:

Vlad Patryshev said...

Thanks man! Saved my day (or rather half a day.

Hofi said...
This comment has been removed by the author.