summaryrefslogtreecommitdiff
path: root/usr.bin/fstat/fuser.1
blob: 5a4c8eae455a89e1d291561f76f0fd691bc2fca0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
.\"	$OpenBSD: fuser.1,v 1.3 2010/02/14 22:56:12 jmc Exp $
.\"
.\" Copyright (c) 2002 Peter Werner <peterw@ifost.org.au>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. The name of the author may not be used to endorse or promote products
.\"    derived from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
.\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
.\" EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLUDING, BUT NOT LIMITED TO,
.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: February 14 2010 $
.Dt FUSER 1
.Os
.Sh NAME
.Nm fuser
.Nd identify process IDs holding specific files open
.Sh SYNOPSIS
.Nm
.Op Fl cfku
.Op Fl M Ar core
.Op Fl N Ar system
.Op Fl s Ar signal
.Ar
.Sh DESCRIPTION
The
.Nm
utility writes to standard output the process IDs of processes running
on the local system that have one or more of the named files open.
If
.Ar file
is a mounted block device, the output will show all processes having
files opened on that file system.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl c
The file is treated as a mount point and
.Nm
will report on any files open in the file system.
.It Fl f
Report only for the named file(s).
.It Fl k
Send the SIGKILL signal to each process.
.It Fl M Ar core
Extract values associated with the name list from the specified core
instead of the running kernel.
.It Fl N Ar system
Extract the name list from the specified system instead of the running kernel.
.It Fl s Ar signal
Send the specified
.Ar signal
to each process.
The
.Ar signal
may be specified as a signal number or as a symbolic name either with
or without the
.Dq SIG
prefix.
Signal names are not case sensitive.
For example, the following signal arguments are equivalent:
.Dq 9 ,
.Dq kill ,
.Dq SIGKILL .
.It Fl u
The real user ID of the process using the file will be printed in brackets
to standard error.
If the username is unable to be determined, the real user ID will be printed
instead.
.El
.Pp
The
.Fl c
and
.Fl f
options are mutually exclusive.
.Pp
The name of the file followed by a colon
.Pq Sq \&:
is printed to standard error.
The following characters may be printed to standard error after the process ID
if the described conditions are true:
.Pp
.Bl -tag -width Ds -offset indent -compact
.It c
The file is the process's current working directory.
.It r
The file is the process's root directory.
.It t
The file is the process's executable text.
.El
.Pp
.Ex -std fuser
.Sh EXAMPLES
Print the process IDs of any processes holding files open under the
.Ar /mnt
filesystem:
.Pp
.Dl $ fuser -c /mnt
.Pp
Send SIGTERM to any process holding a file open under the
.Ar /mnt
filesystem:
.Pp
.Dl # fuser -c -s term /mnt
.Pp
Report on all files opened under the filesystem on which
.Ar /dev/wd0a
is mounted:
.Pp
.Dl $ fuser /dev/wd0a
.Pp
Report on all processes currently holding
.Ar /dev/wd0a
open:
.Pp
.Dl $ fuser -f /dev/wd0a
.Sh SEE ALSO
.Xr fstat 1 ,
.Xr kill 1 ,
.Xr signal 3 ,
.Xr mount 8
.Sh STANDARDS
The
.Nm
utility is compliant with the
.St -p1003.1-2008
specification.
.Pp
The flags
.Op Fl ks
are extensions to that specification.