lsof 命令

lsof

lsof命令用于查看你进程打开的文件,打开文件的进程,进程打开的端口(TCP、UDP)

    -i<条件>:列出符合条件的进程。(4、6、协议、:端口@ip

    -p<进程号>:列出指定进程号所打开的文件;

例:

[root@xuegod63 ~]# vim a.txt

[root@xuegod63 ~]# ps -axu | grep a.txt

root     43641  0.8  0.2 151744  5280 pts/3    S+   18:19   0:00 vim a.txt

root     43652  0.0  0.0 112676   996 pts/1    S+   18:19   0:00 grep --color=auto a.txt

[root@xuegod63 ~]# lsof -p  43641  #一般用于查看木马进程,在读哪些文件

[root@xuegod63 ~]# lsof -i :22    #用于查看端口,或查看黑客开启的后门端口是哪个进程在使用

版权声明:
作者:WaterBear
链接:https://l-t.top/1360.html
来源:雷霆运维
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>