xref: /freebsd/usr.bin/fstat/fuser.1 (revision 640235e2c2ba32947f7c59d168437ffa1280f1e6)
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.\" $FreeBSD$
26.\"
27.Dd May 13, 2011
28.Dt FUSER 1
29.Os
30.Sh NAME
31.Nm fuser
32.Nd list IDs of all processes that have one or more files open
33.Sh SYNOPSIS
34.Nm
35.Op Fl cfkmu
36.Op Fl M Ar core
37.Op Fl N Ar system
38.Op Fl s Ar signal
39.Ar
40.Sh DESCRIPTION
41The
42.Nm
43utility writes to stdout the PIDs of processes that have one or
44more named files open.
45For block and character special devices, all processes using files
46on that device are listed.
47A file is considered open by a process if it was explicitly opened,
48is the working directory, root directory, jail root directory,
49active executable text, kernel trace file or the controlling terminal
50of the process.
51If
52.Fl m
53option is specified, the
54.Nm
55utility will also look through mmapped files.
56.Pp
57The following options are available:
58.Bl -tag -width indent
59.It Fl c
60Treat files as mount point and report on any files open in the file system.
61.It Fl f
62The report must be only for named files.
63.It Fl k
64Send signal to reported processes
65.Pq SIGKILL by default .
66.It Fl m
67Search through mmapped files too.
68.It Fl u
69Write the user name associated with each process to stderr.
70.It Fl M
71Extract values associated with the name list from the specified core
72instead of the default
73.Pa /dev/kmem .
74.It Fl N
75Extract the name list from the specified system instead of the default,
76which is the kernel image the system has booted from.
77.It Fl s
78Use given signal name instead of default SIGKILL.
79.El
80.Pp
81The following symbols, written to stderr will indicate how files is used:
82.Bl -tag -width MOUNT
83.It Cm r
84The file is the root directory of the process.
85.It Cm c
86The file is the current workdir directory of the process.
87.It Cm j
88The file is the jail-root of the process.
89.It Cm t
90The file is the kernel tracing file for the process.
91.It Cm x
92The file is executable text of the process.
93.It Cm y
94The process use this file as its controlling tty.
95.It Cm m
96The file is mmapped.
97.It Cm w
98The file is open for writing.
99.It Cm a
100The file is open as append only
101.Pq O_APPEND was specified .
102.It Cm d
103The process bypasses fs cache while writing to this file
104.Pq O_DIRECT was specified .
105.It Cm s
106Shared lock is hold.
107.It Cm e
108Exclusive lock is hold.
109.El
110.Sh EXIT STATUS
111The
112.Nm
113utility returns 0 on successful completion and >0 otherwise.
114.Sh EXAMPLES
115The command:
116.Dq Li "fuser -fu ."
117writes to standard output the process IDs of processes that are using the
118current directory and writes to stderr an indication of how those processes are
119using the directory and user names associated with the processes that are using
120this directory.
121.Sh SEE ALSO
122.Xr fstat 1 ,
123.Xr ps 1 ,
124.Xr systat 1 ,
125.Xr iostat 8 ,
126.Xr pstat 8 ,
127.Xr vmstat 8
128.Sh STANDARDS
129The
130.Nm
131utility is expected to conform to
132.St -p1003.1-2004 .
133.Sh HISTORY
134The
135.Nm
136utility appeared in
137.Fx 9.0 .
138.Sh AUTHORS
139The
140.Nm
141utility and this manual page was written by
142.An Stanislav Sedov Aq Mt stas@FreeBSD.org .
143.Sh BUGS
144Since
145.Nm
146takes a snapshot of the system, it is only correct for a very short period
147of time.
148When working via
149.Xr kvm 3
150interface the report will be limited to filesystems the
151.Nm
152utility knows about (currently only cd9660, devfs, nfs, ntfs, nwfs, udf,
153ufs and zfs).
154