~$ sudo apt-get

Tag: lsof linux

For a lack of LSOF

by on Aug.28, 2012, under Linux

When you have to deal with system that lacks lsof and cannot be easily installed, you can run the following to show information regarding currently open file handlers.

ls -l `ls -l /proc/*/fd/ 2>/dev/null | grep ">" | cut -d ">" -f 2 | grep "/" | sort | uniq`

If the culprit of disk space usage has already been deleted, you’ll find the following in your output.

ls: /var/log/openvswitch/ovs-vswitchd.log.1: No such file or directory
ls: (deleted): No such file or directory


Teran came up with the following.

for file in `ls -l /proc/*/fd/* | grep deleted | awk '{print $9}'`; do echo -n "$file "; ls -l $file | awk '{print $11}' | tr -d '\n'; stat -L $file | grep Size; done

Leave a Comment : more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...