linux下查看进程打开的文件个数命令

您所在的位置:网站首页 linux命令行打开文件夹 linux下查看进程打开的文件个数命令

linux下查看进程打开的文件个数命令

#linux下查看进程打开的文件个数命令| 来源: 网络整理| 查看: 265

 lsof :list of open files 打开文件数

lsof -n :  This option inhibits the conversion of network numbers to host

                names  for network files.  Inhibiting conversion may make lsof

                run faster.  It is also useful when host name  lookup  is  not

                working properly.

-n 命令加上可能会运行的更快一些,和不加一样。

lsof -n |awk '{print $2}'|sort|sort -rn|grep 进程号

linux下more命令:Displays file contents one screen at a time.

 

 

linux下查看进程打开的文件个数命令_linux

more命令做的功能如上图所示,输入q键退出。

打开文件还有一个命令:lsof -p pid|wc -l(pid =process id)

结果一样:

lsof -p (s) This option excludes or selects the listing of files for the processes

                whose  optional  process  IDentification  (PID)  numbers  are  in  the

                comma-separated set s - e.g., ‘‘123’’ or ‘‘123,^456’’.  (There  should

                be no spaces in the set.)

查看某个文件是由哪个进程使用命令

例子:

[root@xtz /]# man lsof

[root@xtz /]# lsof /home/monitor/agentJava_2013.04.28

COMMAND PID    USER   FD   TYPE DEVICE SIZE     NODE NAME

java    816 monitor  cwd    DIR    8,7 4096 19641615 /home/monitor/agentJava_2013.04.28

 



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3