zoukankan      html  css  js  c++  java
  • 【Linux】常用命令 lsof查看打开的文件

    Linux系统把软硬件都抽象成文件,所以通过文件可以追踪到很多重要信息,如读取的配置文件、打开的端口等。

    下面是常见的用法:

    默认测试文件名为text.txt

    1,显示打开text.txt的进程:

    lsof text.txt

    2,显示占用某个端口的进程:

    lsof -i :80

    3,显示某个进程(进程名)打开的文件:

    lsof -c process_name

    4,显示某个进程号(pid)打开的文件:

    lsof -p pid_number

    5,显示某个用户打开的文件:

    lsof -u user_name

    默认输出字段解释:

    [groot]$lsof -u groot
    COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME

    COMMAND:进程名字(默认下只取前9个字符);

    PID:Process IDentification number;

    USER:the user ID number or login name of the user to whom the process belongs;

    FD:File Descriptor number or

      cwd current working directory;

      ltx   shared library text(code and data);

      mem memory-mapped file;

      mmap memory-mapped device;

      pd   parent directory;

      rtd   root directory;

      txt   program text(code and data);

    TYPE:is the type of the node associated with the file - e.g., GDIR, GREG, VDIR, VREG, etc.

  • 相关阅读:
    7.16PHP所学知识总结
    7.13PHP所学知识总结
    7.11PHP所学知识总结
    2018.08.07jQuery实现焦点轮播图
    2018.07.30js实现轮播图
    2018.07.27javaScript中的DOM操作
    2018.07.23冒泡排序
    2018.07.22 数组
    2018.07.20break和continue的区别
    2018.07.18if条件语句swich条件语句
  • 原文地址:https://www.cnblogs.com/buffalo/p/4787550.html
Copyright © 2011-2022 走看看