1FUSER(1)                         User Commands                        FUSER(1)
2
3
4

NAME

6       fuser - identify processes using files or sockets
7

SYNOPSIS

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

DESCRIPTION

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              .      Placeholder, omitted in default display mode.
27
28       fuser  returns a non-zero return code if none of the specified files is
29       accessed or in case of a fatal error.  If at least one access has  been
30       found, fuser returns zero.
31
32       In  order  to  look  up processes using TCP and UDP sockets, the corre‐
33       sponding name space has to be selected with the -n option.  By  default
34       fuser  will  look in both IPv6 and IPv4 sockets.  To change the default
35       behavior, use the -4 and -6 options.  The socket(s) can be specified by
36       the  local and remote port, and the remote address.  All fields are op‐
37       tional, but commas in front of missing fields must be present:
38
39       [lcl_port][,[rmt_host][,[rmt_port]]]
40
41       Either symbolic or numeric values can be used for IP addresses and port
42       numbers.
43
44       fuser  outputs  only  the  PIDs  to  stdout, everything else is sent to
45       stderr.
46

OPTIONS

48       -a, --all
49              Show all files specified on the command line.  By default,  only
50              files that are accessed by at least one process are shown.
51
52       -c     Same as -m option, used for POSIX compatibility.
53
54       -f     Silently ignored, used for POSIX compatibility.
55
56       -k, --kill
57              Kill processes accessing the file.  Unless changed with -SIGNAL,
58              SIGKILL is sent.  An fuser process never kills itself,  but  may
59              kill  other  fuser  processes.   The  effective  user  ID of the
60              process executing fuser is set to its real user  ID  before  at‐
61              tempting to kill.
62
63       -i, --interactive
64              Ask  the  user  for confirmation before killing a process.  This
65              option is silently ignored if -k is not present too.
66
67       -I, --inode
68              For the name space file let all comparisons be based on the  in‐
69              odes  of  the specified file(s) and never on the file names even
70              on network based file systems.
71
72       -l, --list-signals
73              List all known signal names.
74
75       -m NAME, --mount NAME
76              NAME specifies a file on a mounted file system or a block device
77              that  is  mounted.   All  processes accessing files on that file
78              system are listed.  If a directory is specified, it is automati‐
79              cally  changed  to  NAME/  to  use any file system that might be
80              mounted on that directory.
81
82       -M, --ismountpoint
83              Request will be fulfilled only if NAME specifies  a  mountpoint.
84              This  is an invaluable seat belt which prevents you from killing
85              the machine if NAME happens to not be a filesystem.
86
87       -w     Kill only processes which have write  access.   This  option  is
88              silently ignored if -k is not present too.
89
90       -n NAMESPACE, --namespace NAMESPACE
91              Select  a  different  name  space.   The  name spaces file (file
92              names, the default), udp (local UDP ports), and tcp  (local  TCP
93              ports)  are supported.  For ports, either the port number or the
94              symbolic name can be specified.  If there is no  ambiguity,  the
95              shortcut notation name/space (e.g., 80/tcp) can be used.
96
97       -s, --silent
98              Silent  operation.  -u and -v are ignored in this mode.  -a must
99              not be used with -s.
100
101       -SIGNAL
102              Use the specified signal instead of SIGKILL  when  killing  pro‐
103              cesses.  Signals can be specified either by name (e.g., -HUP) or
104              by number (e.g., -1).  This option is silently ignored if the -k
105              option is not used.
106
107       -u, --user
108              Append the user name of the process owner to each PID.
109
110       -v, --verbose
111              Verbose  mode.   Processes  are  shown  in a ps-like style.  The
112              fields PID, USER and COMMAND are similar to  ps.   ACCESS  shows
113              how  the process accesses the file.  Verbose mode will also show
114              when a particular file is being accessed as a mount point,  knfs
115              export  or  swap  file.  In this case kernel is shown instead of
116              the PID.
117
118       -V, --version
119              Display version information.
120
121       -4, --ipv4
122              Search only for IPv4 sockets.  This option must not be used with
123              the  -6 option and only has an effect with the tcp and udp name‐
124              spaces.
125
126       -6, --ipv6
127              Search only for IPv6 sockets.  This option must not be used with
128              the  -4 option and only has an effect with the tcp and udp name‐
129              spaces.
130

FILES

132       /proc  location of the proc file system
133

EXAMPLES

135       fuser -km /home
136              kills all processes accessing the file system /home in any way.
137
138       if fuser -s /dev/ttyS1; then :; else command; fi
139              invokes command if no other process is using /dev/ttyS1.
140
141       fuser telnet/tcp
142              shows all processes at the (local) TELNET port.
143

RESTRICTIONS

145       Processes accessing the same file or file system several times  in  the
146       same way are only shown once.
147
148       If the same object is specified several times on the command line, some
149       of those entries may be ignored.
150
151       fuser may only be able to gather partial information  unless  run  with
152       privileges.   As  a consequence, files opened by processes belonging to
153       other users may not be listed and  executables  may  be  classified  as
154       mapped only.
155
156       fuser cannot report on any processes that it doesn't have permission to
157       look at the file descriptor table for.  The most common time this prob‐
158       lem occurs is when looking for TCP or UDP sockets when running fuser as
159       a non-root user.  In this case fuser will report no access.
160
161       Installing fuser SUID root will avoid problems associated with  partial
162       information, but may be undesirable for security and privacy reasons.
163
164       udp and tcp name spaces, and UNIX domain sockets can't be searched with
165       kernels older than 1.3.78.
166
167       Accesses by the kernel are only shown with the -v option.
168
169       The -k option only works on processes.  If  the  user  is  the  kernel,
170       fuser will print an advice, but take no action beyond that.
171
172       fuser  will  not  see block devices mounted by processes in a different
173       mount namespace.  This is due to the device ID shown  in  the  process'
174       file  descriptor  table  being from the process namespace, not fuser's;
175       meaning it won't match.
176

BUGS

178       fuser -m /dev/sgX will show (or kill with the -k flag)  all  processes,
179       even  if you don't have that device configured.  There may be other de‐
180       vices it does this for too.
181
182       The mount -m option will match any file within the same device  as  the
183       specified  file,  use the -M option as well if you mean to specify only
184       the mount point.
185

SEE ALSO

187       kill(1), killall(1),  lsof(8),  mount_namespaces(7),  pkill(1),  ps(1),
188       kill(2).
189
190
191
192psmisc                            2022-11-02                          FUSER(1)
Impressum