Fuser (Unix)
Encyclopedia
fuser is a UNIX
command used to show which process
es are using a specified file, file system
, or unix socket
. For example, to check process IDs and users accessing a USB drive:
fuser displays the PIDs of processes using the specified files or file
systems. In the default display mode, each file name is followed by a
letter denoting the type of access:
c : current directory.
e : executable being run.
f : open file.
F : open file for writing.
r : root directory.
m : mmap'ed file or shared library
fuser can also be used to check what processes are using a network port:
fuser returns a non-zero code if none of the files are
accessed or in case of a fatal error. If at least one access has succeeded, fuser returns zero.
The output of "fuser" may be useful in diagnosing "resource busy" messages arising when attempting to unmount
filesystems.
-i : interactive mode. Prompt before killing process
-v : verbose.
-u : append username
-a : display all files
-m : name specifies a file on a mounted file system or a block device that is mounted. All processes accessing files on that file system are listed. If a directory file is specified, it is automatically changed to name/. to use any file system that might be mounted on that directory.
Also note that -k sends a SIGKILL to all process. Use the -signal to send a different signal. For a list of signals supported by the fuser run 'fuser -l'
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...
command used to show which process
Process (computing)
In computing, a process is an instance of a computer program that is being executed. It contains the program code and its current activity. Depending on the operating system , a process may be made up of multiple threads of execution that execute instructions concurrently.A computer program is a...
es are using a specified file, file system
File system
A file system is a means to organize data expected to be retained after a program terminates by providing procedures to store, retrieve and update data, as well as manage the available space on the device which contain it. A file system organizes data in an efficient manner and is tuned to the...
, or unix socket
Unix domain socket
A Unix domain socket or IPC socket is a data communications endpoint for exchanging data between processes executing within the same host operating system. While similar in functionality to...
. For example, to check process IDs and users accessing a USB drive:
fuser displays the PIDs of processes using the specified files or file
systems. In the default display mode, each file name is followed by a
letter denoting the type of access:
c : current directory.
e : executable being run.
f : open file.
F : open file for writing.
r : root directory.
m : mmap'ed file or shared library
fuser can also be used to check what processes are using a network port:
fuser returns a non-zero code if none of the files are
accessed or in case of a fatal error. If at least one access has succeeded, fuser returns zero.
The output of "fuser" may be useful in diagnosing "resource busy" messages arising when attempting to unmount
Mount (Unix)
The Unix command line utility mount instructs the operating system that a file system is ready to use, and associates it with a particular point in the system's file system hierarchy . The counterpart umount instructs the operating system that the file system should be disassociated from its mount...
filesystems.
Options
-k : kills all process accessing a file. For example fuser -k /path/to/your/filename kills all processes accessing this directory without confirmation. Use -i for confirmation-i : interactive mode. Prompt before killing process
-v : verbose.
-u : append username
-a : display all files
-m : name specifies a file on a mounted file system or a block device that is mounted. All processes accessing files on that file system are listed. If a directory file is specified, it is automatically changed to name/. to use any file system that might be mounted on that directory.
Also note that -k sends a SIGKILL to all process. Use the -signal to send a different signal. For a list of signals supported by the fuser run 'fuser -l'
Related commands
- The list of all open files and the processes that have them open can be obtained through the lsofLsoflsof is a command meaning "list open files", which is used in many Unix-like systems to report a list of all open files and the processes that opened them. This open source utility was developed and supported by Vic Abell, the retired Associate Director of the Purdue University Computing Center...
command. - The equivalent command on BSD operating systems is fstat(1)