xref: /freebsd/usr.bin/fstat/fuser.1 (revision fd45b686f9d92f583366c75b22c04c7ee49709c0)
1.\" Copyright (c) 2005-2011 Stanislav Sedov <stas@FreeBSD.org>
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.Dd June 18, 2020
26.Dt FUSER 1
27.Os
28.Sh NAME
29.Nm fuser
30.Nd list IDs of all processes that have one or more files open
31.Sh SYNOPSIS
32.Nm
33.Op Fl cfkmu
34.Op Fl M Ar core
35.Op Fl N Ar system
36.Op Fl s Ar signal
37.Ar
38.Sh DESCRIPTION
39The
40.Nm
41utility writes to stdout the PIDs of processes that have one or
42more named files open.
43For block and character special devices, all processes using files
44on that device are listed.
45A file is considered open by a process if it was explicitly opened,
46is the working directory, root directory, jail root directory,
47active executable text, kernel trace file or the controlling terminal
48of the process.
49If
50.Fl m
51option is specified, the
52.Nm
53utility will also look through mmapped files.
54.Pp
55The following options are available:
56.Bl -tag -width indent
57.It Fl c
58Treat files as mount points and report on any files open in the file system.
59.It Fl f
60The report must be only for named files.
61.It Fl k
62Send signal to reported processes
63.Pq Dv SIGKILL No by default .
64.It Fl M Ar core
65Extract values associated with the name list from the specified core
66instead of the default
67.Pa /dev/kmem .
68.It Fl m
69Search through mmapped files too.
70.It Fl N Ar system
71Extract the name list from the specified system instead of the default,
72which is the kernel image the system has booted from.
73.It Fl s Ar signal
74Use given signal name instead of default
75.Dv SIGKILL .
76.It Fl u
77Write the user name associated with each process to stderr.
78.El
79.Pp
80The following symbols, written to stderr will indicate how files are used:
81.Pp
82.Bl -tag -width indent -compact
83.It Sy a
84The file is open as append only
85.Pq Dv O_APPEND No was specified .
86.It Sy c
87The file is the current workdir directory of the process.
88.It Sy d
89The process bypasses fs cache while writing to this file
90.Pq Dv O_DIRECT No was specified .
91.It Sy e
92Exclusive lock is hold.
93.It Sy j
94The file is the jail root of the process.
95.It Sy m
96The file is mmapped.
97.It Sy r
98The file is the root directory of the process.
99.It Sy s
100Shared lock is hold.
101.It Sy t
102The file is the kernel tracing file for the process.
103.It Sy w
104The file is open for writing.
105.It Sy x
106The file is executable text of the process.
107.It Sy y
108The process uses this file as its controlling tty.
109.El
110.Sh EXIT STATUS
111.Ex -std
112.Sh EXAMPLES
113The command
114.Ql "fuser -fu \&."
115writes to standard output the process IDs of processes that are using the
116current directory and writes to stderr an indication of how those processes are
117using the directory and user names associated with the processes that are using
118this directory.
119.Sh SEE ALSO
120.Xr fstat 1 ,
121.Xr ps 1 ,
122.Xr systat 1 ,
123.Xr iostat 8 ,
124.Xr pstat 8 ,
125.Xr vmstat 8
126.Sh STANDARDS
127The
128.Nm
129utility is expected to conform to
130.St -p1003.1-2004 .
131.Sh HISTORY
132The
133.Nm
134utility appeared in
135.Fx 9.0 .
136.Sh AUTHORS
137The
138.Nm
139utility and this manual page was written by
140.An Stanislav Sedov Aq Mt stas@FreeBSD.org .
141.Sh BUGS
142Since
143.Nm
144takes a snapshot of the system, it is only correct for a very short period
145of time.
146When working via
147.Xr kvm 3
148interface the report will be limited to filesystems the
149.Nm
150utility knows about (currently only cd9660, devfs, nfs, ntfs, nwfs, udf,
151ufs and zfs).
152