lsof linux

RayCongLiang 2020-06-02

lsof  list open files

Linux一切皆文件,通过文件不仅可以访问常规数据,还可以访问网络连接(套接字)和硬件,该文件描述符为应用程序与os之间提供了接口.lsof需访问各种特权文件,故需root运行

lsof linux

 COMMAND contains  the  first nine characters of the name of the UNIX command associated with the process. 默认只显示前9个字符

 PID is the Process IDentification number of the process.

 TID  is the task (thread) IDentification number, if task (thread) reporting is supported by the dialect and a task (thread) is being listed.

 FD is the File Descriptor number of the file or:

  1. cwd  current working directory
  2. mem memory mapped file
  3. rtd root directory
  4. txt program text (code and data)

 FD is followed by one of these characters, describing the mode under which the file is open:

  1. r for read access
  2. w for write access
  3. u for read and write access
  4. space if mode unknow and no lock

 TYPE is the type of the node associated with the file

  1. IPv4 IPv4 socket
  2. IPv6 an open IPv6 network file - even if its address is IPv4, mapped in an IPv6 address
  3. unix UNIX domain socket
  4. DIR directory
  5. FIFO FIFO special file
  6. DEL a linux map file that has been deleted
  7. CHR a charater special file 字符设备文件
  8. BLK a block special file 块设备文件
  9. SOCK  a socket of unknown domain
  10. REG regular file
  11.   

相关推荐