fuser(1M)fuser(1M)NAMEfuser - identify processes using a file or file structure
SYNOPSISfuser [-[c|f]kqu] files [[-] [-[c|f]kqu] files
DESCRIPTIONfuser outputs the process IDs of the processes that are using the files
specified as arguments. Each process ID is followed by one of these
letter codes, which identify how the process is using the file:
c As its current directory.
r As its root directory, which was set up by the chroot(1M) command.
o As an open file.
t As its text file.
m As a mapped file, requested by mmap(2) or exec(2) in the case of
dynamic shared libraries.
y As its controlling terminal.
a As its trace file located in the /proc directory.
For block special devices with mounted filesystems, processes using any
file on that device are listed (unless the -f or -v flags are specified).
If file has the form hostname:pathname and names a mounted NFS
filesystem, all processes using any file in that system are listed.
If file has the form port/protocol and names no files or directory then
fuser lists a process that has a socket bound on the specified port. If
file has the form hostname:port/protocol and names no files or directory
then fuser lists a process that has a socket connected to hostname on the
specified port. port may be either an integer constant or a service name
(see services(4)). protocol must be either tcp, udp, or stp, and
hostname (if specified) must be an Internet address or hostname (see
hosts(4)). For all other types of files (text files, executables,
directories, devices, UNIX-domain sockets, and so on) only the processes
using that file are reported.
The following options may be used with fuser:
-c May be used with files that are mount points for filesystems. With
that option the report is for use of the mount point and any files
within that mounted filesystem.
-f When this is used, the report is only for the named file, not for
files within a mounted filesystem or block device. Note that -f and
-c are mutually exclusive.
Page 1
fuser(1M)fuser(1M)-u The user login name, in parentheses, also follows the process ID.
-q Quiet mode: fuser prints nothing except process IDs separated by
commas to the standard output. This option is useful in conjunction
with the -p option of ps(1).
-k The SIGKILL signal is sent to each process. Since this option
spawns kills for each process, the kill messages may not show up
immediately (see kill(2)).
-v When this is used, the report is only for the vnode number passed in
hex format. This is useful to query vnode numbers listed by the
bufview command. Note that -v, -f, and -c are mutually exclusive.
- A lone dash cancels the options currently in force.
If more than one group of files are specified, the options may be
respecified for each additional group of files.
If the -q flag is not in effect, the process IDs are printed as a single
line on the standard output, separated by spaces and terminated with a
single new line. All other output is written on standard error.
Any user can use fuser. Only a privileged user can terminate another
user's process.
EXAMPLESfuser-cku /usr
If typed by a user with appropriate privileges, terminates all processes
that are preventing /usr filesystem from being unmounted, listing the
process ID and login name of each as it is killed.
fuser-u /etc/passwd
Lists process IDs and login names of processes that have the password
file open.
fuser-cku /usr -u /etc/passwd
Executes both of the above examples in a single command line.
fuser-uv beeff00d
Lists process IDs and login names of processes that have vnode 0xbeeff00d
open.
CAVEATS
TCP, UDP, and STP ports bound by the kernel (e.g. NFS client endpoints)
cannot be mapped to a process ID and no output will be generated.
Page 2
fuser(1M)fuser(1M)
TCP, UDP, and STP ports bound by TLI applications (e.g. rpcbind(1M))
cannot be currently mapped to a process ID and no output will be
generated. This will be corrected in a future release.
If a system has been running for a very long time it is possible for
vnode numbers to roll over. When the -v option is used, the users of any
vnode with the specified number will be reported.
SEE ALSObufview(1), chroot(1M), mount(1M), ps(1), kill(2), signal(2), proc(4).
Page 3