lsof learning

lsof - list open files

Find an open process by file name

lsof filename or lsof | grep filename

 Find by PID process open files, parameters -p

lsof -p pidnum

File descriptor positioning process, the -d

lsof -d file descriptor

View a user opens the file, parameters -u

lsof -u username

According to the port to see the process

lsof -i:22

 

Output meaning (not quite understand a few)

COMMAND process name, too long will only show the first 9

FD file descriptor, divided into two categories

File descriptor, the letters such as numbers 0uW 

0                             U [File Status]                                    W is [File Lock]

 U file descriptor portion of the read-write mode file lock r

                              R read-only file read lock the entire file R

                              w w file write mode file write lock portion

                             Space represents a file status is unknown and there is no lock Write lock the entire file W

                            - indicates that the file is locked and the status is unknown

 

The second class file feature represents

Cwd current directory application, but also the application startup directory

txt file of this type is a program code or data

mem memory-mapped file

pd parent directory

rtd root directory

DEL process indicates that the file has been deleted but is still present in memory

Guess you like

Origin www.cnblogs.com/wanshuduner/p/11115929.html