Update lsof sheet

This commit is contained in:
Shadab Zafar 2016-09-27 21:23:39 +05:30 committed by Chris Lane
parent bcd4563bf3
commit 3139796524
1 changed files with 17 additions and 3 deletions

View File

@ -4,20 +4,34 @@ sudo lsof -i4
# List all IPv6 network files # List all IPv6 network files
sudo lsof -i6 sudo lsof -i6
# To find listening ports: # To find listening ports
lsof -Pnl +M -i4 lsof -Pnl +M -i4
# To find which program is using the port 80: # To list all open sockets
lsof -i
# To find which program is using the port 80
lsof -i TCP:80 lsof -i TCP:80
# To show connections to a specific host
lsof -i@192.168.1.5
# List all processes accessing a particular file/directory # List all processes accessing a particular file/directory
lsof </path/to/file> lsof </path/to/file>
# List all files open for a particular user # List all files open for a particular user
lsof -u <username> lsof -u <username>
# List all files/network connections a given process is using # List all files/network connections a command is using
lsof -c <command-name> lsof -c <command-name>
# List all files a process has open
lsof -p <pid>
# Lists 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 -- </mount/point>
# See this primer: http://www.danielmiessler.com/study/lsof/ # See this primer: http://www.danielmiessler.com/study/lsof/
# for a number of other useful lsof tips # for a number of other useful lsof tips