What is the lsof command?
You can list information about files that are opened by the process. The file that is opened can be
1. Normal file, 2. Directory 3. Network file system file, 4. Character device file 5. (Function) Shared library 6. Pipeline, named pipe 7. Symbol Link 8. The underlying socket word stream, network socket, Unix domain name socket 9. In linux, most of the things are treated as files ….. There are many other
How to use lsof
This article mainly introduces the use of the lsof command in the form of a case
1. List all open files:
[root@web1 ~]# lsof
Remarks: If you do not add any parameters, all open files will be opened. It is recommended to add some parameters to locate
2. See who is using a file
[root@ Web1 ~]# lsof /path/file
3. Recursively view file information of a directory
[root@web1 ~]# lsof +D /path/
Remarks: With +D, all subdirectories and files in the corresponding directory will be listed
4. How to traverse all file information in a directory than using the +D option
[root@web1 ~]# lsof |
Grep '/path/'
5. List file information opened by a user
[root@web1 ~]# lsof -u username
Remarks: -u The option, u is actually the abbreviation of user
6. List the file information opened by a program
[root@web1 ~]# lsof -c httpd
Remarks : The -c option will list all files that start with httpd, but you can also write lsof |
Grep httpd, but the first method is obviously a few characters less than the second method
7. List multiple files with multiple open files
[root@web1 ~ ]# lsof -c mysql -c httpd
8. List a user and the file information opened by a program
[root@web1 ~]# lsof -u test -c Mysql
9. List open file information except for a user
[root@web1 ~]# lsof -u ^barlow
Remarks: ^This Before the user name, the symbol will open the process that is open by the barlow user.
10. Display the file opened by a process number
[root@web1 ~]# Lsof -p 1866
11. List file information corresponding to multiple process numbers
[root@web1 ~]# lsof -p 123,456,789
12. List except A process number, file information opened by other process numbers
[root@web1 ~]# lsof -p ^1
If you want to try a desktop system other than Mac and Windows, Linux should definitely be your fir
Executing programs are called processes. When a program is stored in an executable file and is runni
Speaking of the command, you have to mention this special command vi it is not only a command, but a
What is the boot process for Linux? How to complete the system startup through grub boot? These pro
Sogou Pinyin input method under Linux: ibus-cloud-pinyin
Linux File Sharing - Process and Open File
Linux common compression decompression command set
Linux hwclock display and setting hardware clock command details
Xshell configuration file backup tutorial
10 most common questions about Linux
Rookie Classroom: Several programming languages under Linux that are ignored
Linux 12 is not known 12 insider
How can I solve the Win10 system PIN code?
The resolution of the screen resolution can not be adjusted summary
Win10 10074 How to add my computer to the desktop
Linux more command using tutorial
Win10 quick screenshot skills summary
Win7 system repair disc production method (a)
How to prevent Win8 computer from switching browser window when it is stuck
Win10 upgrade 10166 version error code 0X80310052 how to do?
Four ways to use the Win 7 drawing program to see pictures [Photos]