navek

lsof: A Quick Practical Guide [Video]

1 min read

Check out the video!

lsof Cheatsheet

# List all open ports and their programs
sudo lsof -i:22 ## see a specific port such as 22 ##

# List all open files
lsof -p process-id
lsof -u user

# List all open files
lsof <path/to/file>

# List all open ports

#List open file handles
lsof -p process-id 
lsof -u user
or lsof <path/to/file>
Or ls /proc/process-id/fd


# Non named port
lsof -Pi :8081