aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjohannst <johannes.stoelp@gmail.com>2020-03-17 21:46:01 +0100
committerjohannst <johannes.stoelp@gmail.com>2020-03-17 21:46:01 +0100
commit9d196827ce5e5f342af4be4ffd3e25dbf9cb66bb (patch)
tree7132d1e313896d57a41d891a29bd983e5869c1a7
parent14fad56fff1633df972f86775a15a65ca4a24c48 (diff)
downloadnotes-9d196827ce5e5f342af4be4ffd3e25dbf9cb66bb.tar.gz
notes-9d196827ce5e5f342af4be4ffd3e25dbf9cb66bb.zip
updated lsof
-rw-r--r--src/lsof.md16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/lsof.md b/src/lsof.md
index a7ed2d1..8253003 100644
--- a/src/lsof.md
+++ b/src/lsof.md
@@ -3,10 +3,10 @@
```markdown
lsof
-a ......... AND slection filters instead ORing (OR: default)
- -p <pid> ... list open file descriptors for process
+ -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 know service names
+ -P ......... don't convert network port to service names
-i <@h[:p]>. show connections to h (hostname|ip addr) with optional port p
```
@@ -20,17 +20,21 @@ file flags:
# Examples
-Show open files with file flags:
+## File flags
+Show open files with file flags for process:
```markdown
lsof +fg -p <pid>
```
-
-Show open tcp connections from user:
+## Open TCP connections
+Show open tcp connections for `$USER`:
```markdown
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_).
-Show open connections to 'localhost' for user:
+## Open connection to specific host
+Show open connections to `localhost` for `$USER`:
```markdown
lsof -a -u $USER -i @localhost
```