用lsof查看进程打开的文件情况

来源:互联网 发布:js test函数 编辑:程序博客网 时间:2024/05/04 07:36
lsof语法格式是:
lsof [options] filename
lsof abc.txt 显示开启文件abc.txt的进程lsof -c abc 显示abc进程现在打开的文件lsof -c -p 1234 列出进程号为1234的进程所打开的文件lsof -g gid 显示归属gid的进程情况lsof +d /usr/local/ 显示目录下被进程开启的文件lsof +D /usr/local/ 同上,但是会搜索目录下的目录,时间较长lsof -d 4 显示使用fd为4的进程lsof -i 用以显示符合条件的进程情况lsof -i[46] [protocol][@hostname|hostaddr][:service|port]  46 --> IPv4 or IPv6  protocol --> TCP or UDP  hostname --> Internet host name  hostaddr --> IPv4地址  service --> /etc/service中的 service name (可以不止一个)  port --> 端口号 (可以不止一个)
1 0
原创粉丝点击