Fuser (Unix)
   HOME

TheInfoList



OR:

The
Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and ot ...
command Command may refer to: Computing * Command (computing), a statement in a computer language * COMMAND.COM, the default operating system shell and command-line interpreter for DOS * Command key, a modifier key on Apple Macintosh computer keyboards * ...
fuser is used to show which
process A process is a series or set of activities that interact to produce a result; it may occur once-only or be recurrent or periodic. Things called a process include: Business and management *Business process, activities that produce a specific se ...
es are using a specified
computer file A computer file is a computer resource for recording data in a computer storage device, primarily identified by its file name. Just as words can be written to paper, so can data be written to a computer file. Files can be shared with and transfe ...
,
file system In computing, file system or filesystem (often abbreviated to fs) is a method and data structure that the operating system uses to control how data is stored and retrieved. Without a file system, data placed in a storage medium would be one larg ...
, or
Unix socket Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and ...
.


Example

For example, to check process IDs and users accessing a USB drive: $ fuser -m -u /mnt/usb1 /mnt/usb1: 1347c(root) 1348c(guido) 1349c(guido) The command displays the
process identifier In computing, the process identifier (a.k.a. process ID or PID) is a number used by most operating system kernels—such as those of Unix, macOS and Windows—to uniquely identify an active process. This number may be used as a parameter in vario ...
s (PIDs) of processes using the specified files or file systems. In the default display mode, each PID 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 Only the PIDs are written to
standard output In computer programming, standard streams are interconnected input and output communication channels between a computer program and its environment when it begins execution. The three input/output (I/O) connections are called standard input (stdin ...
. Additional information is written to standard error. This makes it easier to process the output with computer programs. The command can also be used to check what processes are using a network port: $ fuser -v -n tcp 80 USER PID ACCESS COMMAND 80/tcp: root 3067 F.... (root)httpd apache 3096 F.... (apache)httpd apache 3097 F.... (apache)httpd The command 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.


Options

POSIX The Portable Operating System Interface (POSIX) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. POSIX defines both the system- and user-level application programming interf ...
defines the following options: :; -c : Treat the file as a
mount point Mounting is a process by which a computer's operating system makes files and directories on a storage device (such as hard drive, CD-ROM, or network share) available for users to access via the computer's file system. In general, the process ...
. :; -f : Only report processes accessing the named files. :; -u : Append user names in parentheses to each PID. psmisc adds the following options, among others: :; -k, --kill : Kill all processes accessing a file by sending a
SIGKILL Signals are standardized messages sent to a running program to trigger specific behavior, such as quitting or error handling. They are a limited form of inter-process communication (IPC), typically used in Unix, Unix-like, and other POSIX-comp ...
. Use e.g. -HUP or -1 to send a different
signal In signal processing, a signal is a function that conveys information about a phenomenon. Any quantity that can vary over space or time can be used as a signal to share messages between observers. The '' IEEE Transactions on Signal Processing' ...
. :; -l, --list-signals : List all supported signal names. :; -i, --interactive : Prompt before killing a process. :; -v, --verbose :
verbose mode In computing, Verbose mode is an option available in many computer operating systems and programming languages that provides additional details as to what the computer is doing and what drivers and software it is loading during startup or in prog ...
:; -a, --all : Display all files. Without this option, only files accessed by at least one process are shown. :; -m, --mount : Same as -c. Treat all following path names as files on a
mounted Mount is often used as part of the name of specific mountains, e.g. Mount Everest. Mount or Mounts may also refer to: Places * Mount, Cornwall, a village in Warleggan parish, England * Mount, Perranzabuloe, a hamlet in Perranzabuloe parish, Co ...
file system or
block device In Unix-like operating systems, a device file or special file is an interface to a device driver that appears in a file system as if it were an ordinary file. There are also special files in DOS, OS/2, and Windows. These special files allow an ...
. All processes accessing files on that file system are listed.


Related commands

* The list of all open files and the processes that have them open can be obtained through the
lsof lsof 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 Victor A. Abell, the retired Asso ...
command. * The equivalent command on
BSD The Berkeley Software Distribution or Berkeley Standard Distribution (BSD) is a discontinued operating system based on Research Unix, developed and distributed by the Computer Systems Research Group (CSRG) at the University of California, Berk ...
operating systems is .


References


External links

Unix SUS2008 utilities Unix process- and task-management-related software {{Unix-stub