Linux command lsof use tutorial

  
 

lsof full name list opened files, which is a list of files that have been opened in the system. We all know that in the Linux environment, everything is a file, a device is a file, a directory is a file, and even sockets are files. Therefore, using the lsof command is very helpful for daily Linux management.

The lsof syntax format is: lsof [options] filename

Common list of parameters:

lsof filename Shows all processes that open the specified file lsof -a means both parameters The result must be displayed when the lsof -c string is displayed. The COMMAND column contains all the open files of the specified characters. lsof -u username Displays the file opened by the user process. lsof -g gid shows the status of the owned gid process lsof +d /DIR/Display the file lsof +D /DIR/opened by the process in the directory, but the directory will be searched for all the directories. The time is relatively long. lsof -d FD The process that displays the specified file descriptor lsof -n does not convert the IP to hostname. The default is to add the -n parameter lsof -i to display the conditional process condition lsof -i[46] [protocol][@hostname

Copyright © Windows knowledge All Rights Reserved