doc: Update lsof.md #577
This commit is contained in:
parent
9b2d0a2da4
commit
fe5f89b457
|
|
@ -156,8 +156,100 @@ lsof -i:9981 -P -t -sTCP:LISTEN
|
||||||
```shell
|
```shell
|
||||||
lsof $filename
|
lsof $filename
|
||||||
```
|
```
|
||||||
|
|
||||||
查看端口占用
|
查看端口占用
|
||||||
```shell
|
```shell
|
||||||
lsof -i:$port
|
lsof -i:$port
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**查看所有打开的文件:**
|
||||||
|
|
||||||
|
```
|
||||||
|
lsof
|
||||||
|
```
|
||||||
|
|
||||||
|
**查看指定进程打开的文件:**
|
||||||
|
|
||||||
|
```
|
||||||
|
lsof -p <PID>
|
||||||
|
```
|
||||||
|
|
||||||
|
**查看指定用户打开的文件:**
|
||||||
|
|
||||||
|
```
|
||||||
|
lsof -u <username>
|
||||||
|
```
|
||||||
|
|
||||||
|
**查看指定文件名相关的进程:**
|
||||||
|
|
||||||
|
```
|
||||||
|
lsof <filename>
|
||||||
|
```
|
||||||
|
|
||||||
|
**查看网络连接相关的进程:**
|
||||||
|
|
||||||
|
```
|
||||||
|
lsof -i
|
||||||
|
```
|
||||||
|
|
||||||
|
**查看指定端口相关的进程:**
|
||||||
|
|
||||||
|
```
|
||||||
|
lsof -i :<port>
|
||||||
|
```
|
||||||
|
|
||||||
|
**查看正在使用某个目录的进程:**
|
||||||
|
|
||||||
|
```
|
||||||
|
lsof +D /path/to/directory
|
||||||
|
```
|
||||||
|
|
||||||
|
**查看被删除但仍然被某个进程打开的文件:**
|
||||||
|
|
||||||
|
```
|
||||||
|
lsof -u +L1
|
||||||
|
```
|
||||||
|
|
||||||
|
**查看某个文件系统上被打开的文件:**
|
||||||
|
|
||||||
|
```
|
||||||
|
lsof /mountpoint
|
||||||
|
```
|
||||||
|
|
||||||
|
**以列表形式显示结果:**
|
||||||
|
|
||||||
|
```
|
||||||
|
lsof -F
|
||||||
|
```
|
||||||
|
|
||||||
|
**显示结果中不包含主机名:**
|
||||||
|
|
||||||
|
```
|
||||||
|
lsof -n
|
||||||
|
```
|
||||||
|
|
||||||
|
**显示结果中不包含进程路径:**
|
||||||
|
|
||||||
|
```
|
||||||
|
lsof -b
|
||||||
|
```
|
||||||
|
|
||||||
|
**以逆序显示结果:**
|
||||||
|
|
||||||
|
```
|
||||||
|
lsof -r
|
||||||
|
```
|
||||||
|
|
||||||
|
**以特定间隔时间循环显示结果:**
|
||||||
|
|
||||||
|
```
|
||||||
|
lsof -r <interval>
|
||||||
|
```
|
||||||
|
|
||||||
|
**以持续模式显示结果:**
|
||||||
|
|
||||||
|
```
|
||||||
|
lsof -t <interval>
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue