xref: /openbsd-src/usr.bin/fstat/fuser.1 (revision f273b081c91dc2a2c134252b43a1b2c9bf96c926)
1*f273b081Sschwarze.\"	$OpenBSD: fuser.1,v 1.8 2017/10/17 22:47:58 schwarze Exp $
2666d0576Smillert.\"
3666d0576Smillert.\" Copyright (c) 2002 Peter Werner <peterw@ifost.org.au>
4666d0576Smillert.\" All rights reserved.
5666d0576Smillert.\"
6666d0576Smillert.\" Redistribution and use in source and binary forms, with or without
7666d0576Smillert.\" modification, are permitted provided that the following conditions
8666d0576Smillert.\" are met:
9666d0576Smillert.\"
10666d0576Smillert.\" 1. Redistributions of source code must retain the above copyright
11666d0576Smillert.\"    notice, this list of conditions and the following disclaimer.
12666d0576Smillert.\" 2. The name of the author may not be used to endorse or promote products
13666d0576Smillert.\"    derived from this software without specific prior written permission.
14666d0576Smillert.\"
15666d0576Smillert.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
16666d0576Smillert.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
17666d0576Smillert.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
18666d0576Smillert.\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19666d0576Smillert.\" EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20666d0576Smillert.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21666d0576Smillert.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22666d0576Smillert.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23666d0576Smillert.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24666d0576Smillert.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25666d0576Smillert.\"
26*f273b081Sschwarze.Dd $Mdocdate: October 17 2017 $
27666d0576Smillert.Dt FUSER 1
28666d0576Smillert.Os
29666d0576Smillert.Sh NAME
30666d0576Smillert.Nm fuser
31666d0576Smillert.Nd identify process IDs holding specific files open
32666d0576Smillert.Sh SYNOPSIS
33666d0576Smillert.Nm
34666d0576Smillert.Op Fl cfku
35666d0576Smillert.Op Fl M Ar core
36666d0576Smillert.Op Fl N Ar system
37666d0576Smillert.Op Fl s Ar signal
38666d0576Smillert.Ar
39666d0576Smillert.Sh DESCRIPTION
40666d0576SmillertThe
41666d0576Smillert.Nm
42666d0576Smillertutility writes to standard output the process IDs of processes running
43666d0576Smillerton the local system that have one or more of the named files open.
44666d0576SmillertIf
45666d0576Smillert.Ar file
46666d0576Smillertis a mounted block device, the output will show all processes having
47666d0576Smillertfiles opened on that file system.
48666d0576Smillert.Pp
49666d0576SmillertThe options are as follows:
50666d0576Smillert.Bl -tag -width Ds
51666d0576Smillert.It Fl c
52666d0576SmillertThe file is treated as a mount point and
53666d0576Smillert.Nm
54666d0576Smillertwill report on any files open in the file system.
55666d0576Smillert.It Fl f
56666d0576SmillertReport only for the named file(s).
57666d0576Smillert.It Fl k
58666d0576SmillertSend the SIGKILL signal to each process.
59666d0576Smillert.It Fl M Ar core
60666d0576SmillertExtract values associated with the name list from the specified core
61666d0576Smillertinstead of the running kernel.
62666d0576Smillert.It Fl N Ar system
63666d0576SmillertExtract the name list from the specified system instead of the running kernel.
64666d0576Smillert.It Fl s Ar signal
65666d0576SmillertSend the specified
66666d0576Smillert.Ar signal
67666d0576Smillertto each process.
68666d0576SmillertThe
69666d0576Smillert.Ar signal
70666d0576Smillertmay be specified as a signal number or as a symbolic name either with
71666d0576Smillertor without the
72666d0576Smillert.Dq SIG
73666d0576Smillertprefix.
74666d0576SmillertSignal names are not case sensitive.
75666d0576SmillertFor example, the following signal arguments are equivalent:
76666d0576Smillert.Dq 9 ,
77666d0576Smillert.Dq kill ,
78666d0576Smillert.Dq SIGKILL .
79666d0576Smillert.It Fl u
807b2632f8StbThe username of the process using the file will be printed in brackets
81666d0576Smillertto standard error.
82666d0576SmillertIf the username is unable to be determined, the real user ID will be printed
83666d0576Smillertinstead.
84666d0576Smillert.El
85666d0576Smillert.Pp
86666d0576SmillertThe
87666d0576Smillert.Fl c
88666d0576Smillertand
89666d0576Smillert.Fl f
90666d0576Smillertoptions are mutually exclusive.
91666d0576Smillert.Pp
92666d0576SmillertThe name of the file followed by a colon
93666d0576Smillert.Pq Sq \&:
94666d0576Smillertis printed to standard error.
95666d0576SmillertThe following characters may be printed to standard error after the process ID
96666d0576Smillertif the described conditions are true:
97666d0576Smillert.Pp
98666d0576Smillert.Bl -tag -width Ds -offset indent -compact
99666d0576Smillert.It c
100666d0576SmillertThe file is the process's current working directory.
101666d0576Smillert.It r
102666d0576SmillertThe file is the process's root directory.
10364f4df25Smillert.It t
10464f4df25SmillertThe file is the process's executable text.
105666d0576Smillert.El
106f1c64ac4Sjmc.Sh EXIT STATUS
107666d0576Smillert.Ex -std fuser
108666d0576Smillert.Sh EXAMPLES
109666d0576SmillertPrint the process IDs of any processes holding files open under the
110666d0576Smillert.Ar /mnt
111666d0576Smillertfilesystem:
112666d0576Smillert.Pp
113666d0576Smillert.Dl $ fuser -c /mnt
114666d0576Smillert.Pp
115666d0576SmillertSend SIGTERM to any process holding a file open under the
116666d0576Smillert.Ar /mnt
117666d0576Smillertfilesystem:
118666d0576Smillert.Pp
119666d0576Smillert.Dl # fuser -c -s term /mnt
120666d0576Smillert.Pp
121666d0576SmillertReport on all files opened under the filesystem on which
122666d0576Smillert.Ar /dev/wd0a
123666d0576Smillertis mounted:
124666d0576Smillert.Pp
125666d0576Smillert.Dl $ fuser /dev/wd0a
126666d0576Smillert.Pp
127666d0576SmillertReport on all processes currently holding
128666d0576Smillert.Ar /dev/wd0a
129666d0576Smillertopen:
130666d0576Smillert.Pp
131666d0576Smillert.Dl $ fuser -f /dev/wd0a
132666d0576Smillert.Sh SEE ALSO
133666d0576Smillert.Xr fstat 1 ,
134666d0576Smillert.Xr kill 1 ,
135666d0576Smillert.Xr signal 3 ,
136666d0576Smillert.Xr mount 8
137666d0576Smillert.Sh STANDARDS
138666d0576SmillertThe
139666d0576Smillert.Nm
140666d0576Smillertutility is compliant with the
141c8724b2eSjmcX/Open System Interfaces option of the
142666d0576Smillert.St -p1003.1-2008
143666d0576Smillertspecification.
144666d0576Smillert.Pp
145666d0576SmillertThe flags
146e6a351dfSjmc.Op Fl kMNs
147666d0576Smillertare extensions to that specification.
148*f273b081Sschwarze.Sh HISTORY
149*f273b081SschwarzeThe
150*f273b081Sschwarze.Nm
151*f273b081Sschwarzeutility has been available since
152*f273b081Sschwarze.Ox 4.7 .
153