{{{#!highlight sh # List all open files lsof # Processes using a file? (fuser equivalent) lsof /path/to/file # Open files within a directory lsof +D /path # Files by user lsof -u name lsof -u name1,name2 lsof -u name1 -u name2 # By program name lsof -c apache # AND'ing selection conditions lsof -u www-data -c apache # By pid lsof -p 1 # Except certain pids lsof -p ^1 # TCP and UDP connections lsof -i lsof -i tcp # TCP connections lsof -i udp # UDP connections # By port lsof -i :25 lsof -i :smtp lsof -i udp:53 lsof -i tcp:80 # All network activity by a user lsof -a -u name1 -i lsof -N # NFS use lsof -U # UNIX domain socket use # List PIDs lsof -t -i kill -9 $(lsof -t -i) # Kill all programs w/network activity }}} ---- CategoryCheatSheet