aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/monitor
diff options
context:
space:
mode:
authorjohannst <johannes.stoelp@gmail.com>2020-10-02 11:28:11 +0200
committerjohannst <johannes.stoelp@gmail.com>2020-10-02 11:28:11 +0200
commitd0f74b8605d72868c49fec7d27225398118f9409 (patch)
tree268650bc9f412300079336e59b5c726ea2049e92 /src/monitor
parent871f1a6f408a9b50182c8688d4aeec26bd6b2d93 (diff)
downloadnotes-d0f74b8605d72868c49fec7d27225398118f9409.tar.gz
notes-d0f74b8605d72868c49fec7d27225398118f9409.zip
updated lsof
Diffstat (limited to 'src/monitor')
-rw-r--r--src/monitor/lsof.md23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/monitor/lsof.md b/src/monitor/lsof.md
index 8253003..f621abe 100644
--- a/src/monitor/lsof.md
+++ b/src/monitor/lsof.md
@@ -2,12 +2,15 @@
```markdown
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))
```
```markdown
@@ -18,6 +21,18 @@ file flags:
TR ......... truncate
```
+```markdown
+-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
@@ -25,10 +40,11 @@ Show open files with file flags for process:
```markdown
lsof +fg -p <pid>
```
+
## Open TCP connections
Show open tcp connections for `$USER`:
```markdown
-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_).
@@ -38,3 +54,8 @@ Show open connections to `localhost` for `$USER`:
```markdown
lsof -a -u $USER -i @localhost
```
+
+## IPv4 TCP connections in `ESTABLISHED` state
+```markdown
+lsof -i 4TCP -s TCP:ESTABLISHED
+```