LSOF Commands Cheat Sheet
Here is a cli commands cheat sheet for LSOF command, you can use this as a quick reminder for basic commands with a brief description for each of the commands.
What is LSOF command?
Add some data here
# To list all IPv4 network files: sudo lsof -i4 # To list all IPv6 network files: sudo lsof -i6 # To list all open sockets: lsof -i # To list all listening ports: lsof -Pnl +M -i4 # To find which program is using the port 80: lsof -i TCP:80 # To list all connections to a specific host: lsof [email protected] # To list all processes accessing a particular file/directory: lsof
# To list all files open for a particular user: lsof -u # To list all files/network connections a command is using: lsof -c # To list all files a process has open: lsof -p # To 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 --
Check out the LSOF command documentation .
You can also check our MegaSh cheatsheet tool, that has 150+ searchable linux cheat sheets in one page, so you never forget a command as you work again