1. view the process & ldquo; open the file & rdquo;: 1) pidofprograme-name (obtain the PID of the process (programe-name) you want to know) or ps-aux | grepprograme-name (obtain the PID of the process (programe-name) you want to know) to find the PID2 of the process) cd/proc/$ PID/fd (the file descriptor will be seen) 3) ls-l to get
1. view the files opened by the process:
1) pidof programe-name (obtain the PID of the process (programe-name) you want to know)
Or ps-aux | grep programe-name (obtain the PID of the process (programe-name) you want to know)
Find the PID of the process
2) cd/proc/$ PID/fd (the file descriptor is displayed)
3) ls-l
Get the actual file pointed to by the file descriptor, that is, the file opened by the current process.
2. view the file opened by the process. 2:
1) obtain the PID method of the process you want to know.
2) lsof-c programe-name
Or lsof-p $ PID
3. view the process corresponding to the file:
Lsof file-name
4. lsof command usage:
Lsof-c abc displays the files currently opened by the abc process
Lsof abc displays the process for enabling file abc
Lsof-I: 22 shows what programs are running on port 22
Lsof-g gid: displays the processes that belong to the gid.
Lsof + d/usr/local/Display files opened by processes in the directory
Lsof + D/usr/local /.
Lsof-d 4 displays processes with fd 4
Lsof-I is used to display qualified processes
Lsof-s lists the size of open files. if there is no size, leave blank
Lsof-u username uses UID to list open files
5. view the network status:
Lsof-Pnl + M-i4 displays ipv4 service and listener status
Netstat-anp all listening ports and corresponding processes
Netstat-tlnp functions are the same as above