Table of Contentsfuser - identify processes using files fuser [-a|-s] [-n space] [-signal] [-kmuv] filename ... [-] [-n space] [-signal] [-kmuv] filename ...
fuser -l
fuser -V 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 specified files is accessed or in case of a fatal error. If at least one access has been found, fuser returns zero.
- -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 processes. The effective user ID of the process executing 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.
- -n space
- Select a different name space. The name spaces file (file names, the default), udp (local UDP ports), and tcp (local TCP ports) are supported. For ports, either the port number or the symbolic name can be specified. For the name spaces udp and tcp, the shortcut notation port/proto can be used.
- -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.
/proc location of the proc file system
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.
fuser telnet/tcp shows all processes at the (local) TELNET port.
Processes accessing the same file or file system several times in the same way are only shown once. If the same object is specified several times on the command line, some of those entries may be ignored.
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 security and privacy reasons.
udp and tcp name spaces, and UNIX domain sockets can't be searched with kernels older than 1.3.78.
Werner Almesberger <werner.almesberger@lrc.di.epfl.ch> kill(1), killall(1), ps(1), kill(2)
Table of Contents
www.fiveanddime.net