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