18 examples for lsof
# Show which PIDs have the most files open sudo lsof | awk '{print $2}' | sort | uniq -c | sort -n
# Show what files or filehandles are open in the /tmp directory (if its not a seperate partition). This can be slow. lsof +D /tmp
# List open network connections without resolving hostnames, userids, or ports (via '/etc/services'). Makes it faster. lsof -i -nlP
# Show local server listening port 80 lsof -i:80 -sTCP:LISTEN # Show all local servers lsof -sTCP:LISTEN