From beb173a31622e99e40301d95bc74c0e63be7bea9 Mon Sep 17 00:00:00 2001 From: johannst Date: Fri, 2 Oct 2020 09:28:40 +0000 Subject: deploy: d0f74b8605d72868c49fec7d27225398118f9409 --- print.html | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'print.html') diff --git a/print.html b/print.html index 1b1bc35..7179ad2 100644 --- a/print.html +++ b/print.html @@ -1147,12 +1147,15 @@ executed. To workaround that bug one can create a wrapper function which calls

lsof(8)

lsof
+  -r <s> ..... repeatedly execute command ervery <s> seconds
   -a ......... AND slection filters instead ORing (OR: default)
   -p <pid> ... filter by <pid>
   +fg ........ show file flags for file descripros
   -n ......... don't convert network addr to hostnames
   -P ......... don't convert network port to service names
   -i <@h[:p]>. show connections to h (hostname|ip addr) with optional port p
+  -s <p:s> ... in conjunction with '-i' filter for protocol <p> in state <s>
+  -U ......... show unix domain sockets ('@' indicates abstract sock name, see unix(7))
 
file flags:
   R/W/RW ..... read/write/read-write
@@ -1160,6 +1163,16 @@ executed. To workaround that bug one can create a wrapper function which calls
   AP ......... append
   TR ......... truncate
 
+
-s protocols
+  TCP, UDP
+
+-s states (TCP)
+  CLOSED, IDLE, BOUND, LISTEN, ESTABLISHED, SYN_SENT, SYN_RCDV, ESTABLISHED,
+  CLOSE_WAIT, FIN_WAIT1, CLOSING, LAST_ACK, FIN_WAIT_2, TIME_WAIT
+
+-s states (UDP)
+  Unbound, Idle
+

Examples

File flags

Show open files with file flags for process:

@@ -1167,7 +1180,7 @@ executed. To workaround that bug one can create a wrapper function which calls

Open TCP connections

Show open tcp connections for $USER:

-
lsof -a -u $USER -i tcp
+
lsof -a -u $USER -i TCP
 

Note: -a ands the results. If -a is not given all open files matching $USER and all tcp connections are listed (ored).

@@ -1175,6 +1188,9 @@ executed. To workaround that bug one can create a wrapper function which calls

Show open connections to localhost for $USER:

lsof -a -u $USER -i @localhost
 
+

IPv4 TCP connections in ESTABLISHED state

+
lsof -i 4TCP -s TCP:ESTABLISHED
+

pidstat(1)

pidstat [opt] [interval] [cont]
   -U [user]     show username instead UID, optionally only show for user
-- 
cgit v1.2.3