天天看點

5.8. 根據檔案描述列出對應的檔案資訊

lsof -d  fd_type

[root@netkiller ~]# lsof -d 2

COMMAND     PID      USER   FD   TYPE DEVICE SIZE/OFF    NODE NAME

init          1      root    2u   CHR    1,3      0t0    3794 /dev/null

根據檔案描述範圍列出檔案資訊

[root@netkiller ~]# lsof -d 2-4

COMMAND     PID      USER   FD   TYPE             DEVICE  SIZE/OFF       NODE NAME

init          1      root    2u   CHR                1,3       0t0       3794 /dev/null

列出COMMAND列中包含字元串" httpd",且檔案描符的類型為txt的檔案資訊

[root@netkiller ~]# lsof -c httpd -a -d txt

COMMAND  PID USER  FD   TYPE DEVICE SIZE/OFF    NODE NAME

httpd   2374 root txt    REG    8,2  1772950 4985314 /usr/local/apache/bin/httpd

原文出處:Netkiller 系列 手劄

本文作者:陳景峯

轉載請與作者聯系,同時請務必标明文章原始出處和作者資訊及本聲明。