Lsof

From Ezee.co.uk

Jump to: navigation, search

Handy for finding out what files are being opened by a process. Particularly useful when trying to umount a device and can't

List all process's listening on port 80

/usr/sbin/lsof -i :80

This is handy for finding why apache won't restart with port already open messages. Use kill -9 PID to kill it then restart.
Or use this command kill $2 `/usr/sbin/lsof -i :80 | grep -v PID | awk '{print $2}'`

List all files linked to a specific process id

lsof -p PID

example:
lsof -p 2431

Do more on this page later

Personal tools