From 94a147ba773b01561f54c199d2e91a349db04a31 Mon Sep 17 00:00:00 2001 From: Amit Saha Date: Tue, 26 Nov 2013 13:20:24 +1000 Subject: [PATCH] Enhancements to 'lsof' cheatsheet. --- cheatsheets/lsof | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/cheatsheets/lsof b/cheatsheets/lsof index 607c1ca..cc19485 100644 --- a/cheatsheets/lsof +++ b/cheatsheets/lsof @@ -1,8 +1,23 @@ -# List all ipv4 network files +# List all IPv4 network files sudo lsof -i4 +# List all IPv6 network files +sudo lsof -i6 + # To find listening ports: lsof -Pnl +M -i4 # To find which program is using the port 80: lsof -i TCP:80 + +# 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 given process is using +lsof -c + +# See this primer: http://www.danielmiessler.com/study/lsof/ +# for a number of other useful lsof tips