In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Linux system lsof command use, I believe that many inexperienced people do not know what to do, so this paper summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
The lsof command in the Linux system is a tool used to list the files opened by the current system, and it is a very convenient command.
Introduction to the lsof command: lsof (list open files) is a tool that lists files opened by the current system.
In the linux environment, everything exists in the form of files, through which you can access not only regular data, but also network connections and hardware. Therefore, lsof is very powerful.
The average root user can execute the lsof command, and the ordinary user can see the / usr/sbin/lsof command, but the average user execution will display "permission denied".
Being able to view this list through the lsof tool will be very helpful for system monitoring and troubleshooting.
Enter lsof under the terminal to display the files opened by the system. Because lsof needs to access core memory and various files, it must be run as a root user in order to give full play to its functions.
Each line displays one open file, and if you do not specify conditions, all files opened by all processes will be displayed by default. The meaning of each column of information output by lsof is as follows: COMMAND: process name PID: process identifier USER: process owner FD: file descriptor, which the application identifies by the file descriptor. TYPE, such as cwd, txt, etc.: file type, such as DIR, REG, etc. DEVICE: specify the name of the disk SIZE: file size NODE: Inode (identification of the file on disk) NAME: exact name of the open file
The use of the lsof instruction is as follows:
Lsof abc.txt shows the process of opening the file abc.txt
Lsof directory name to find out who is using the file directory system
Lsof-I: 22 know which process port 22 is occupied by
Lsof-c abc displays the files now opened by the abc process
Lsof-g gid shows the process that belongs to the gid
Lsof-n does not convert IP to hostname. By default, the-n parameter is not added.
Lsof-p 12 to see which files are opened by the process with process number 12
Lsof-u username to see which files the user opens
Lsof-I @ 192.168.1.111 to view remote open network connections (connect to 192.168.1.111)--
Lsof-I is used to display eligible processes.
Syntax: lsof-I [46] protocol [: service | port]
46-> IPv4 or IPv6
Protocol-> TCP or UDP
Hostname-> Internet hostname
Hostaddr-> IPv4 location
Service name in service-> / etc/service (can be more than one)
Port-> port number (can be more than one)
-- lsof + |-r [t] controls the repeated execution of lsof. The default is 15s refresh.
-rrecoery lsof will be executed forever until the interrupt signal is received
+ rforce lsof will be executed until no files are displayed
Example: constantly check the current ftp connection: lsof-I tcp@192.168.1.111:ftp-r
What are the versions of Linux? the versions of Linux are Deepin, UbuntuKylin, Manjaro, LinuxMint, Ubuntu and so on. Among them, Deepin is one of the best-developed Linux distributions in China; UbuntuKylin is a derivative release based on Ubuntu; Manjaro is a Linux release based on Arch; LinuxMint's default Cinnamon desktop is similar to Windows XP's easy-to-use; Ubuntu is the Linux operating system based on desktop applications.
After reading the above, have you mastered how to use the lsof command in the Linux system? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.