fuser
Hurricane Electric Internet Services
NAME
fuser - identify processes using files
SYNOPSIS
fuser [-a|-s] [-signal] [-kmuv] filename ... [-] [-sig-
nal] [-kmuv] filename ...
fuser -l
fuser -V
DESCRIPTION
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 is omitted in default display
mode.
r root directory.
m mmap'ed file or shared library.
fuser returns a non-zero return code if none of the speci-
fied files is accessed or in case of a fatal error. If at
least one access has been found, fuser returns zero.
OPTIONS
-a Show all files specified on the command line. By
default, only files that are accessed by at least
one process are shown.
-k Kill processes accessing the file. Unless changed
with -signal, SIGKILL is sent. An fuser process
never kills itself, but may kill other fuser pro-
cesses. The effective user ID of the process exe-
cuting fuser is set to its real user ID before
attempting to kill.
-l List all known signal names.
-m filename 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 filename/. to use any file system that
might be mounted on that directory.
-s Silent operation. -a, -u and -v are ignored in this
mode.
-signal
use the specified signal instead of SIGKILL when
killing processes. Signals can be specified either
by name (e.g. -HUP) or by number (e.g. -1).
-u Append the user name of the process owner to each
PID.
-v Verbose mode. Processes are shown in a ps-like
style. The fields PID, USER and COMMAND are similar
to ps. ACCESS shows how the process accesses the
file.
-V Display version information.
- Reset all options and set the signal back to
SIGKILL.
FILES
/proc location of the proc file system
EXAMPLES
fuser -km /home kills all processes accessing the file
system /home in any way.
if fuser -s /dev/ttyS1; then :; else something; fi invokes
something if no other process is using /dev/ttyS1.
RESTRICTIONS
Processes accessing the same file or file system several
times in the same way are only shown once.
fuser may only be able to gather partial information
unless run with privileges. As a consequence, files opened
by processes belonging to other users may not be listed
and executables may be classified as mapped only.
Installing fuser SUID root will avoid problems associated
with partial information, but may be undesirable for secu-
rity and privacy reasons.
AUTHOR
Werner Almesberger <werner.almesberger@lrc.di.epfl.ch>
SEE ALSO
kill(1), killall(1), ps(1), kill(2)
Hurricane Electric Internet Services
Copyright (C) 1998
Hurricane Electric.
All Rights Reserved.