# List all IPv4 network files sudo lsof -i4 # List all IPv6 network files sudo lsof -i6 # List all open sockets lsof -i # List all listening ports lsof -Pnl +M -i4 # Find which program is using the port 80 lsof -i TCP:80 # List all connections to a specific host lsof -i@192.168.1.5 # List all processes accessing a particular file/directory lsof # List all files open for a particular user lsof -u # List all files/network connections a command is using lsof -c # List all files a process has open lsof -p # List all files open mounted at /mount/point. # Particularly useful for finding which process(es) are using a # mounted USB stick or CD/DVD. lsof +f -- # See this primer: http://www.danielmiessler.com/study/lsof/ # for a number of other useful lsof tips