Use the fuser command of linux to identify processes using files or file structures
This article mainly introduces the use of linux fuser command to use the file or file structure recognition process, the article is very detailed, has a certain reference value, interested friends must read it!
The fuser command is used to report the files and network sockets used by the process.
The fuser command shows which program is currently using a file, mount point, or even a network port on disk, and gives details of the program process. It also displays the process ID that uses the specified file or file system.
Each process number is followed by a letter indicating how the process uses the file.
C: indicates the working directory of the process. E: indicates that the file is the executable of the process (that is, the process is pulled by the file). F: indicates that the file is opened by the process, and the f character is not displayed by default. F: indicates that the file is opened for writing by the process, and the F character is not displayed by default. R: indicates that the directory is the root of the process. M: instructs the process to use this file for memory mapping, or whether the file is a shared library file and is mapped to memory by the process.
Syntax format: fuser [parameters] [file]
Common parameters:
Reference example
To list the process number of the local process that uses the / etc/passwd file:
[root@linuxcool ~] # fuser / etc/passwd
List the process number and user login name of the process that uses the / etc/filesystems file:
[root@linuxcool] # fuser-u / etc/filesystems
Terminate all processes that use a given file system:
[root@linuxcool] # fuser-k-x-u-c / dev/hd1 is all the contents of the file or file structure identification process using linux's fuser command. Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!