man-pages/man1/fuser.1.html
2021-03-31 01:06:50 +01:00

456 lines
9.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of FUSER</TITLE>
</HEAD><BODY>
<H1>FUSER</H1>
Section: User Commands (1)<BR>Updated: 2016-04-04<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
fuser - identify processes using files or sockets
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>fuser</B>
[<B>-fuv</B>]
[<B>-a</B>|<B>-s</B>]
[<B>-4</B>|<B>-6</B>]
[<B>-c</B>|<B>-m</B>|<B>-n</B>
<I>space</I>]
[<B>&nbsp;-k</B>
[<B>-i</B>]
[<B>-M</B>]
[<B>-w</B>]
[<B>-</B><I>SIGNAL</I>]
]
<I>name</I> ...
<BR>
<B>fuser -l</B>
<BR>
<B>fuser -V</B>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<B>fuser</B>
displays the PIDs of processes using the specified files or file
systems. In the default display mode, each file name is followed by a
letter denoting the type of access:
<P>
<DL COMPACT><DT id="1"><DD>
<DL COMPACT>
<DT id="2"><B>c</B>
<DD>
current directory.
<DT id="3"><B>e</B>
<DD>
executable being run.
<DT id="4"><B>f</B>
<DD>
open file.
<B>f</B>
is omitted in default display mode.
<DT id="5"><B>F</B>
<DD>
open file for writing.
<B>F</B>
is omitted in default display mode.
<DT id="6"><B>r</B>
<DD>
root directory.
<DT id="7"><B>m</B>
<DD>
mmap'ed file or shared library.
<DT id="8"><B>.</B>
<DD>
Placeholder, omitted in default display mode.
</DL>
</DL>
<P>
<B>fuser</B>
returns a non-zero return code if none of the specified files is
accessed or in case of a fatal error. If at least one access has been
found,
<B>fuser</B>
returns zero.
<P>
In order to look up processes using TCP and UDP sockets, the
corresponding name space has to be selected with the
<B>-n</B>
option. By default
<B>fuser</B>
will look in both IPv6 and IPv4 sockets. To change the default,
behavior, use the
<B>-4</B>
and
<B>-6</B>
options. The socket(s) can be specified by the local and remote port,
and the remote address. All fields are optional, but commas in front
of missing fields must be present:
<P>
[<I>lcl_port</I>][,[<I>rmt_host</I>][,[<I>rmt_port</I>]]]
<P>
Either symbolic or numeric values can be used for IP addresses and port
numbers.
<P>
<B>fuser</B>
outputs only the PIDs to stdout, everything else is sent to stderr.
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
<DL COMPACT>
<DT id="9"><B>-a</B>, <B>--all</B>
<DD>
Show all files specified on the command line. By default, only files
that are accessed by at least one process are shown.
<DT id="10"><B>-c</B>
<DD>
Same as -m option, used for POSIX compatibility.
<DT id="11"><B>-f</B>
<DD>
Silently ignored, used for POSIX compatibility.
<DT id="12"><B>-k</B>, --kill
<DD>
Kill processes accessing the file. Unless changed with
<B>-</B><I>SIGNAL/</I>, SIGKILL is sent.
An
<B>fuser</B>
process never kills itself, but may kill other
<B>fuser</B>
processes. The effective user ID of the process executing
<B>fuser</B>
is set to its real user ID before attempting to kill.
<DT id="13"><B>-i</B>, <B>--interactive</B>
<DD>
Ask the user for confirmation before killing a process.
This option is
silently ignored if
<B>-k</B>
is not present too.
<DT id="14"><B>-I</B>, <B>--inode</B>
<DD>
For the name space
<B>file</B>
let all comparisons be based on the inodes of the specified file(s)
and never on the file names even on network based file systems.
<DT id="15"><B>-l</B>, <B>--list-signals</B>
<DD>
List all known signal names.
<DT id="16"><B>-m</B><I> NAME </I>, <B>--mount </B><I>NAME</I>
<DD>
<I>NAME</I>
specifies a file on a mounted file system or a block device that is
mounted. All processes accessing files on that file system are listed.
If a directory file is specified, it is automatically changed to
<I>NAME</I>/.
to use any file system that might be mounted on that directory.
<DT id="17"><B>-M</B>, <B>--ismountpoint</B>
<DD>
Request will be fulfilled only if
<I>NAME</I>
specifies a mountpoint. This is an invaluable seat belt which prevents
you from killing the machine if
<I>NAME</I>
happens to not be a filesystem.
<DT id="18"><B>-w</B>
<DD>
Kill only processes which have write access. This option is silently
ignored if
<B>-k</B>
is not present too.
<DT id="19"><B>-n</B><I> SPACE</I>, <B>--namespace </B><I>SPACE</I>
<DD>
Select a different name space. The name spaces
<B>file</B>
(file names, the default),
<B>udp</B>
(local UDP ports), and
<B>tcp</B>
(local TCP ports) are supported. For ports, either the port number or
the symbolic name can be specified. If there is no ambiguity, the
shortcut notation
<I>name</I><B>/</B><I>space</I>
(e.g.,
<I>80</I><B>/</B><I>tcp</I><B></B>)
can be used.
<DT id="20"><B>-s</B>, <B>--silent</B>
<DD>
Silent operation.
<B>-u</B>
and
<B>-v</B>
are ignored in this mode.
<B>-a</B>
must not be used with
<B>-s</B>.
<DT id="21"><B>-</B><I>SIGNAL</I>
<DD>
Use the specified signal instead of SIGKILL when killing processes.
Signals can be specified either by name (e.g.,
<B>-HUP</B>)
or by number (e.g.,
<B>-1</B>).
This option is silently ignored if the
<B>-k</B>
option is not used.
<DT id="22"><B>-u</B>, <B>--user</B>
<DD>
Append the user name of the process owner to each PID.
<DT id="23"><B>-v</B>, <B>--verbose</B>
<DD>
<P>
Verbose mode. Processes are shown in a
<B>ps</B>-like
style. The fields PID, USER and COMMAND are similar to
<B>ps</B>.
ACCESS shows how the process accesses the file. Verbose mode will also
show when a particular file is being accessed as a mount point, knfs
export or swap file. In this case
<B>kernel</B>
is shown instead of the PID.
<DT id="24"><B>-V</B>, <B>--version</B>
<DD>
Display version information.
<DT id="25"><B>-4</B>, <B>--ipv4</B>
<DD>
Search only for IPv4 sockets. This option must not be used with the
<B>-6</B>
option and only has an effect with the tcp and udp namespaces.
<DT id="26"><B>-6</B>, <B>--ipv6</B>
<DD>
Search only for IPv6 sockets. This option must not be used with the
<B>-4</B>
option and only has an effect with the tcp and udp namespaces.
<DT id="27"><B>-</B><DD>
Reset all options and set the signal back to SIGKILL.
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>FILES</H2>
<DL COMPACT>
<DT id="28">/proc<DD>
location of the proc file system
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>EXAMPLES</H2>
<DL COMPACT>
<DT id="29"><B>fuser -km /home</B>
<DD>
kills all processes accessing the file system /home in any way.
<DT id="30"><B>if fuser -s /dev/ttyS1; then :; else </B><I>something</I><B>; fi</B>
<DD>
invokes
<I>something</I>
if no other process is using /dev/ttyS1.
<DT id="31"><B>fuser telnet/tcp</B>
<DD>
shows all processes at the (local) TELNET port.
</DL>
<A NAME="lbAH">&nbsp;</A>
<H2>RESTRICTIONS</H2>
Processes accessing the same file or file system several times in the
same way are only shown once.
<P>
If the same object is specified several times on the command line, some
of those entries may be ignored.
<P>
<B>fuser</B>
may only be able to gather partial information unless run with
privileges. As a consequence, files opened by processes belonging to
other users may not be listed and executables may be classified as
mapped only.
<P>
<B>fuser</B>
cannot report on any processes that it doesn't have permission to look
at the file descriptor table for. The most common time this problem
occurs is when looking for TCP or UDP sockets when running
<B>fuser</B>
as a non-root user. In this case
<B>fuser</B>
will report no access.
<P>
Installing
<B>fuser</B>
SUID root will avoid problems associated with partial information, but
may be undesirable for security and privacy reasons.
<P>
<B>udp</B>
and
<B>tcp</B>
name spaces, and UNIX domain sockets can't be searched with kernels
older than 1.3.78.
<P>
Accesses by the kernel are only shown with the
<B>-v</B>
option.
<P>
The
<B>-k</B>
option only works on processes. If the user is the kernel,
<B>fuser</B>
will print an advice, but take no action beyond that.
<A NAME="lbAI">&nbsp;</A>
<H2>BUGS</H2>
<P>
fuser -m /dev/sgX will show (or kill with the -k flag) all processes,
even if you don't have that device configured. There may be other
devices it does this for too.
<P>
The mount -m option will match any file within the same device as the
specified file, use the -M option as well if you mean to specify only
the mount point.
<A NAME="lbAJ">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?1+kill">kill</A></B>(1),
<B><A HREF="/cgi-bin/man/man2html?1+killall">killall</A></B>(1),
<B><A HREF="/cgi-bin/man/man2html?8+lsof">lsof</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?1+pkill">pkill</A></B>(1),
<B><A HREF="/cgi-bin/man/man2html?1+ps">ps</A></B>(1),
<B><A HREF="/cgi-bin/man/man2html?2+kill">kill</A></B>(2).
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="32"><A HREF="#lbAB">NAME</A><DD>
<DT id="33"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="34"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="35"><A HREF="#lbAE">OPTIONS</A><DD>
<DT id="36"><A HREF="#lbAF">FILES</A><DD>
<DT id="37"><A HREF="#lbAG">EXAMPLES</A><DD>
<DT id="38"><A HREF="#lbAH">RESTRICTIONS</A><DD>
<DT id="39"><A HREF="#lbAI">BUGS</A><DD>
<DT id="40"><A HREF="#lbAJ">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:12 GMT, March 31, 2021
</BODY>
</HTML>