1FUSER(1) User Commands FUSER(1)
2
3
4
6 fuser - identify processes using files or sockets
7
9 fuser [-a|-s|-c] [-4|-6] [-n space ] [-k [-i] [-signal ] ] [-muvf]
10 name ...
11 fuser -l
12 fuser -V
13
15 fuser displays the PIDs of processes using the specified files or file
16 systems. In the default display mode, each file name is followed by a
17 letter denoting the type of access:
18
19 c current directory.
20
21 e executable being run.
22
23 f open file. f is omitted in default display mode.
24
25 F open file for writing. F is omitted in default display
26 mode.
27
28 r root directory.
29
30 m mmap'ed file or shared library.
31
32 fuser returns a non-zero return code if none of the specified files is
33 accessed or in case of a fatal error. If at least one access has been
34 found, fuser returns zero.
35
36 In order to look up processes using TCP and UDP sockets, the corre‐
37 sponding name space has to be selected with the -n option. By default
38 fuser will look in both IPv6 and IPv4 sockets. To change the default,
39 behavior, use the -4 and -6 options. The socket(s) can be specified by
40 the local and remote port, and the remote address. All fields are
41 optional, but commas in front of missing fields must be present:
42
43 [lcl_port][,[rmt_host][,[rmt_port]]]
44
45 Either symbolic or numeric values can be used for IP addresses and port
46 numbers.
47
48 fuser outputs only the PIDs to stdout, everything else is sent to
49 stderr.
50
52 -a Show all files specified on the command line. By default, only
53 files that are accessed by at least one process are shown.
54
55 -c Same as -m option, used for POSIX compatibility.
56
57 -f Silently ignored, used for POSIX compatibility.
58
59 -k Kill processes accessing the file. Unless changed with -signal,
60 SIGKILL is sent. An fuser process never kills itself, but may
61 kill other fuser processes. The effective user ID of the process
62 executing fuser is set to its real user ID before attempting to
63 kill.
64
65 -i Ask the user for confirmation before killing a process. This
66 option is silently ignored if -k is not present too.
67
68 -l List all known signal names.
69
70 -m name specifies a file on a mounted file system or a block device
71 that is mounted. All processes accessing files on that file sys‐
72 tem are listed. If a directory file is specified, it is auto‐
73 matically changed to name/. to use any file system that might be
74 mounted on that directory.
75
76 -n space
77 Select a different name space. The name spaces file (file names,
78 the default), udp (local UDP ports), and tcp (local TCP ports)
79 are supported. For ports, either the port number or the symbolic
80 name can be specified. If there is no ambiguity, the shortcut
81 notation name/Ispace (e.g. 80/tcp ) can be used.
82
83 -s Silent operation. -u and -v are ignored in this mode. -a must
84 not be used with -s.
85
86 -signal
87 Use the specified signal instead of SIGKILL when killing pro‐
88 cesses. Signals can be specified either by name (e.g. -HUP) or
89 by number (e.g. -1). This option is silently ignored if the -k
90 option is not used.
91
92 -u Append the user name of the process owner to each PID.
93
94 -v Verbose mode. Processes are shown in a ps-like style. The fields
95 PID, USER and COMMAND are similar to ps. ACCESS shows how the
96 process accesses the file. If the access is by the kernel (e.g.
97 in the case of a mount point, a swap file, etc.), kernel is
98 shown instead of the PID.
99
100 -V Display version information.
101
102 -4 Search only for IPv4 sockets. This option must not be used with
103 the -6 option and only has an effect with the tcp and udp names‐
104 paces.
105
106 -6 Search only for IPv6 sockets. This option must not be used with
107 the -4 option and only has an effect with the tcp and udp names‐
108 paces.
109
110 - Reset all options and set the signal back to SIGKILL.
111
113 /proc location of the proc file system
114
116 fuser -km /home kills all processes accessing the file system /home in
117 any way.
118
119 if fuser -s /dev/ttyS1; then :; else something; fi invokes something if
120 no other process is using /dev/ttyS1.
121
122 fuser telnet/tcp shows all processes at the (local) TELNET port.
123
125 Processes accessing the same file or file system several times in the
126 same way are only shown once.
127
128 If the same object is specified several times on the command line, some
129 of those entries may be ignored.
130
131 fuser may only be able to gather partial information unless run with
132 privileges. As a consequence, files opened by processes belonging to
133 other users may not be listed and executables may be classified as
134 mapped only.
135
136 Installing fuser SUID root will avoid problems associated with partial
137 information, but may be undesirable for security and privacy reasons.
138
139 udp and tcp name spaces, and UNIX domain sockets can't be searched with
140 kernels older than 1.3.78.
141
142 udp and tcp currently work with IPv6 and IPv4, but the address fields
143 can only be IPv4 addresses.
144
145 Accesses by the kernel are only shown with the -v option.
146
147 The -k option only works on processes. If the user is the kernel, fuser
148 will print an advice, but take no action beyond that.
149
150 fuser cannot report on any processes that it doesn't have permission to
151 look at the file descriptor table for. The most common time this prob‐
152 lem occurs is when looking for TCP or UDP sockets when running fuser as
153 a non-root user. In this case fuser will report no access.
154
156 fuser -m /dev/sgX will show (or kill with the -k flag) all processes,
157 even if you don't have that device configured. There may be other
158 devices it does this for too.
159
161 Werner Almesberger <werner@almesberger.net>
162
163 Craig Small <csmall@small.dropbear.id.au>
164
166 kill(1), killall(1), lsof(8), ps(1), kill(2).
167
168
169
170Linux 2005-11-05 FUSER(1)