For Linux operating systems, the Lsof command is detailed. generally, root users can execute the lsof command. common users can see the/usr/sbin/lsof command, however, normal user execution will display permissiondenied. I will summarize the usage of the lsof command: lsofabc.txtshows the introduction of the open file abc.txt... for Linux operating systems, the Lsof command is detailed. generally, root users can execute the lsof command. common users can see the/usr/sbin/lsof command,
However, normal user execution will display "permission denied"
I will summarize the usage of the lsof command: lsof abc.txt displays the process lsof-I for opening the file abc.txt: 22. The program lsof-c abc running on port 22 displays the file lsof-g gid opened by the abc process.
Lsof + d/usr/local/displays the files opened by the process in the directory lsof + D/usr/local, for a long time, lsof-d 4 shows the syntax for displaying qualified processes by using the process www.2cto.com lsof-I with fd 4: lsof-I [46] [protocol] [@ hostname | hostaddr] [: service | port] 46 --> IPv4 or IPv6protocol --> TCP or UDPhostname --> Internet host namehostaddr --> IPv4 location service --> service name in/etc/service (either one or more) port --> port number (either)
Example: TCP: 25-TCP and port 25@1.2.3.4-Internet IPv4 host address 1.2.3.4tcp@ohaha.ks.edu.tw: ftp-TCP protocol hosthaha.ks.edu.tw service name: ftplsof-n do not convert IP to hostname, the-n parameter is not added by default.
Example: lsof-I tcp@ohaha.ks.edu.tw: ftp-nlsof-p 12 look at what files opened by the process with process number 12 lsof + |-r [t] control lsof for repeated execution, the default value is refresh-r for 15 seconds. lsof will continue to execute until the interrupt signal + r is received, and lsof will continue to execute until no files are displayed.
Example: keep viewing the current ftp connection: lsof-I tcp@ohaha.ks.edu.tw: ftp-rlsof-s list the size of the open file, if there is no size, leave a blank lsof-u username with UID, list opened files: www.2cto.com author san_yun
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service