aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/lsof.md
blob: a7ed2d1589b62e8777d31674f6bc53ea33cf98bc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# lsof(8)

```markdown
lsof
  -a ......... AND slection filters instead ORing (OR: default)
  -p <pid> ... list open file descriptors for process
  +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
  -i <@h[:p]>. show connections to h (hostname|ip addr) with optional port p
```

```markdown
file flags:
  R/W/RW ..... read/write/read-write
  CR ......... create
  AP ......... append
  TR ......... truncate
```

# Examples

Show open files with file flags:
```markdown
lsof +fg -p <pid>
```

Show open tcp connections from user:
```markdown
lsof -a -u $USER -i tcp
```

Show open connections to 'localhost' for user:
```markdown
lsof -a -u $USER -i @localhost
```