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
131       -      Reset all options and set the signal back to SIGKILL.
132

FILES

134       /proc  location of the proc file system
135

EXAMPLES

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

RESTRICTIONS

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

BUGS

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

SEE ALSO

184       kill(1), killall(1), lsof(8), pkill(1), ps(1), kill(2).
185
186
187
188psmisc                            2020-09-09                          FUSER(1)
Impressum