cheat/cheat/cheatsheets/lsof

24 lines
530 B
Plaintext
Raw Normal View History

2013-11-26 04:20:24 +01:00
# List all IPv4 network files
2013-10-09 00:16:31 +02:00
sudo lsof -i4
2013-11-26 04:20:24 +01:00
# List all IPv6 network files
sudo lsof -i6
2013-08-30 12:16:48 +02:00
# To find listening ports:
2013-08-26 16:51:57 +02:00
lsof -Pnl +M -i4
2013-08-30 12:16:48 +02:00
# To find which program is using the port 80:
2013-09-01 19:30:44 +02:00
lsof -i TCP:80
2013-11-26 04:20:24 +01:00
# List all processes accessing a particular file/directory
lsof </path/to/file>
# List all files open for a particular user
lsof -u <username>
# List all files/network connections a given process is using
lsof -c <command-name>
# See this primer: http://www.danielmiessler.com/study/lsof/
# for a number of other useful lsof tips