How to use the fuser tool on Linux

  
                

In Linux, the fuser tool can be used to query the user of the file. In addition, the fuser has many uses and can be used with parameters. The following small series will give you a detailed introduction to the use of the fuser tool. It is helpful to you.

lsof also has a similar function, it can also find the process that is accessing the specified file, the difference between the two is that the user can kill the process that is accessing the specified file at a time.

The common use of fuser is:

fuser can be used to query the use of files, directories, socket ports and file systems, and can use fuser to close the process.

When the file system umount reports that the device is busy, it is common to the fuser to query and close the process using the corresponding file system. (At the time of switching may be used DRBD oh);

use:

substantially that substantially most of the contents may be displayed with -v:

The user in the /root directory, the process ID, the c after the PID represents the working directory of the process, followed by the specific command;

access has other options:

e: The file is the executable file of the process;

f: The file is opened by the process, the default f is not displayed;

F: The file is opened by the process and written, the default F is not displayed ;

r: indicates that the directory is the root directory of the process;

m: indicates that the process uses the file for memory mapping, or the file is a shared library file, which is mapped to memory by the process; br>

situation socket port users query:

View a file system usage:

kill off access to a file is Process:

The fuser sends a SIGKILL signal to the relevant process. In addition to sending SIGKILL signal outside, fuser can also send the following signals:

fuser -v -k filename;

To end all processes for access to a file system:

fuser -ck /data (directory of a file system mount);

The above is the introduction of the method of using the fuser tool in Linux. The fuser plus -v can display the process content and can be on the socket. The port user's situation can be queried, and the file system usage can be queried.

Copyright © Windows knowledge All Rights Reserved