linux查看进程grep工作组,Linux下查看一个进程打开了哪...-linux 如何找到进程的工作目录...-使用 grep 恢复误删的文本文件_169IT.COM...

这篇博客介绍了在Linux环境下使用'lsof'命令来查看特定进程打开的文件,以及如何查找哪个进程打开了指定文件。示例中展示了如何查看PID为14755的httpd进程所打开的文件,以及所有打开'/usr/sbin/httpd'文件的进程。
摘要由CSDN通过智能技术生成

Linux下查看一个进程打开了哪些文件的命令示例,供大家学习参考。

查看进程14755(httpd)打开了哪些文件:

代码如下:

localhost:~# lsof -p 14755

COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME

httpd 14755 apache cwd DIR 8,1 4096 2 /

httpd 14755 apache rtd DIR 8,1 4096 2 /

httpd 14755 apache txt REG 8,1 332264 9241061 /usr/sbin/httpd

httpd 14755 apache DEL REG 0,9 34211 /dev/zero

httpd 14755 apache DEL REG 0,9 34213 /dev/zero

httpd 14755 apache mem REG 8,1 143600 5636098 /lib64/ld-2.5.so

httpd 14755 apache mem REG 8,1 615136 5636111 /lib64/libm-2.5.so

httpd 14755 apache mem REG 8,1 129984 5636110 /lib64/libpcre.so.0.0.1

httpd 14755 apache mem REG 8,1 95464 5636153 /lib64/libselinux.so.1

httpd 14755 apache mem REG 8,1 108136 24491378 /usr/lib64/libaprutil-1.so.0.2.7

httpd 14755 apache mem REG 8,1 48600 5636156 /lib64/libcrypt-2.5.so

httpd 14755 apache mem REG 8,1 245488 24496044 /usr/lib64/libldap-2.3.so.0.2.31

httpd 14755 apache mem REG 8,1 59040 24493410 /usr/lib64/liblber-2.3.so.0.2.31

httpd 14755 apache mem REG 8,1 1008656 5636170 /lib64/libdb-4.3.so

httpd 14755 apache mem REG 8,1 143144 5636289 /lib64/libexpat.so.0.5.0

httpd 14755 apache mem REG 8,1 160944 24490671 /usr/lib64/libapr-1.so.0.2.7

httpd 14755 apache mem REG 8,1 145824 5636131 /lib64/libpthread-2.5.so

httpd 14755 apache mem REG 8,1 23360 5636107 /lib64/libdl-2.5.so

找到哪些进程打开了/usr/sbin/httpd文件:

代码如下:

localhost:~# lsof  /usr/sbin/httpd

COMMAND   PID   USER  FD   TYPE DEVICE   SIZE    NODE NAME

httpd   14746   root txt    REG    8,1 332264 9241061 /usr/sbin/httpd

httpd   14747 apache txt    REG    8,1 332264 9241061 /usr/sbin/httpd

httpd   14748 apache txt    REG    8,1 332264 9241061 /usr/sbin/httpd

httpd   14750 apache txt    REG    8,1 332264 9241061 /usr/sbin/httpd

httpd   14751 apache txt    REG    8,1 332264 9241061 /usr/sbin/httpd

httpd   14752 apache txt    REG    8,1 332264 9241061 /usr/sbin/httpd

httpd   14753 apache txt    REG    8,1 332264 9241061 /usr/sbin/httpd

httpd   14754 apache txt    REG    8,1 332264 9241061 /usr/sbin/httpd

httpd   14755 apache txt    REG    8,1 332264 9241061 /usr/sbin/httpd

localhost:~# pidof /usr/sbin/httpd

14754 14753 14752 14751 14750 14748 14747 14746

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值