FUSER(1)
๐ FUSER(1) ๐
User Commands section, bestie. This is the manual page for fuser, and it is an absolute icon ๐
โจ NAME โจ
fuser - identify processes using files or sockets ๐
๐ธ SYNOPSIS ๐ธ
fuser [-fuv] [-a|-s] [-4|-6] [-c|-m|-n space] [ -k [-i] [-M] [-w]
[-SIGNAL] ] name ...
fuser -l
fuser -V
๐ DESCRIPTION ๐
okay so fuser shows you the PIDs of whatever processes are using the files or file systems you point it at. ๐ฆ In the default display mode, every file name gets a letter after it that tells you how that process is using it. it's giving detective energy, honestly โจ
cโ current directory.eโ executable being run.fโ open file.fis left out in default display mode.Fโ open file for writing.Fis left out in default display mode.rโ root directory.mโ mmap'ed file or shared library..โ placeholder, left out in default display mode.
fuser returns a non-zero return code if none of the files you gave it are accessed, or if something goes wrong and it's a fatal error. ๐ญ If at least one access gets found, fuser returns zero. that's the vibe โ
now for the socket girlies ๐ง to look up processes using TCP and UDP sockets, you have to pick the matching name space with the -n option. by default, fuser looks in both IPv6 and IPv4 sockets. if you want to change that, use the -4 and -6 options. you can point at a socket using its local and remote port, plus the remote address. every field is optional, but the commas in front of any missing fields still have to be there, no cap ๐ซถ
[lcl_port][,[rmt_host][,[rmt_port]]]
You can use symbolic or numeric values for IP addresses and port numbers. both are valid, so you do you ๐
and lowkey important: fuser only sends the PIDs to stdout. everything else gets sent to stderr ๐
๐ OPTIONS ๐
-a,--allโ show all the files you listed on the command line. by default, only files that at least one process is actually accessing get shown ๐-cโ same as the-moption. it's here for POSIX compatibility, so it's giving "official" energy ๐-fโ silently ignored. it's only here for POSIX compatibility, so don't stress about it ๐-k,--killโ kills the processes accessing the file ๐ unless you change it with-SIGNAL, the signal sent is SIGKILL. anfuserprocess never kills itself, but it can kill otherfuserprocesses (chaotic but valid). before it tries to kill anything, the effective user ID of the process runningfusergets set to its real user ID ๐-i,--interactiveโ asks you to confirm before killing each process. this one gets silently ignored if-kisn't there too, so it needs its bestie ๐ซ-I,--inodeโ for the name space file, every comparison is based on the inodes of the file(s) you specified, and never on the file names. this applies even on network based file systems โจ-l,--list-signalsโ lists every known signal name ๐-m NAME,--mount NAMEโ NAME is a file on a mounted file system, or a block device that's mounted. all processes accessing files on that file system get listed. if you give it a directory, it's automatically changed toNAME/so it can catch any file system that might be mounted on that directory ๐๏ธ-M,--ismountpointโ your request only gets fulfilled if NAME is actually a mountpoint. this is an invaluable seat belt ๐ชข because it stops you from accidentally killing the whole machine if NAME turns out not to be a filesystem ๐ฑ-wโ kills only processes with write access. this one gets silently ignored if-kisn't there too ๐ฅ-n NAMESPACE,--namespace NAMESPACEโ picks a different name space. the ones that are supported arefile(file names, the default),udp(local UDP ports), andtcp(local TCP ports). for ports, you can use either the port number or the symbolic name. if there's no ambiguity, you can use the shortcutname/spacenotation, like80/tcp๐ฏ-s,--silentโ silent operation.-uand-vare ignored in this mode. you must not use-awith-sโ-SIGNALโ sends the signal you name instead of SIGKILL when killing processes. you can say the signal by name (like-HUP) or by number (like-1). this gets silently ignored if you don't use-kโก-u,--userโ tacks the user name of the process owner onto each PID ๐งโ๐คโ๐ง-v,--verboseโ verbose mode, where processes show up in a ps-like style ๐ the PID, USER and COMMAND fields are similar tops. ACCESS shows how the process is accessing the file. verbose mode also shows when a file is being accessed as a mount point, knfs export or swap file. in that case,kernelshows up instead of a PID ๐ง-V,--versionโ displays version information ๐ท๏ธ-4,--ipv4โ searches only IPv4 sockets. this must not be used together with-6, and it only does anything with thetcpandudpname spaces ๐-6,--ipv6โ searches only IPv6 sockets. this must not be used together with-4, and it only does anything with thetcpandudpname spaces ๐
๐ง FILES ๐ง
/procโ location of the proc file system ๐
๐ EXAMPLES ๐
fuser -km /home
kills all processes accessing the file system /home in any way. ๐ (big yikes energy, use wisely)
if fuser -s /dev/ttyS1; then :; else command; fi
invokes command if no other process is using /dev/ttyS1. so smart ๐ง
fuser telnet/tcp
shows all processes at the (local) TELNET port. ๐
๐ง RESTRICTIONS ๐ง
โ ๏ธ heads up bestie, these are the limits. read them, they matter.
Processes accessing the same file or file system several times in the same way are only shown once. ๐ฏ
If the same object is specified several times on the command line, some of those entries may be ignored. ๐
fuser may only be able to gather partial information unless it's run with privileges. as a result, files opened by processes belonging to other users may not be listed, and executables may be classified as mapped only. ๐ค
fuser cannot report on any processes that it doesn't have permission to look at the file descriptor table for. the most common time this happens is when you're looking for TCP or UDP sockets while running fuser as a non-root user. in that case, fuser will report no access ๐ฅฒ
Installing fuser SUID root will avoid the problems that come with partial information, but it may be undesirable for security and privacy reasons ๐
udp and tcp name spaces, and UNIX domain sockets can't be searched with kernels older than 1.3.78 ๐ฆ
Accesses by the kernel are only shown with the -v option. ๐ซฃ
The -k option only works on processes. if the user is the kernel, fuser will print an advice, but it won't take any action beyond that ๐คทโโ๏ธ
fuser will not see block devices mounted by processes in a different mount namespace. this is because the device ID shown in the process' file descriptor table comes from the process namespace, not fuser's. so it won't match ๐
โโ๏ธ
๐ BUGS ๐
๐ชฒ these are known bugs, so be careful out there
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 ๐ฌ
The -m option will match any file within the same device as the specified file. if you only mean to specify the mount point, use the -M option as well ๐ฏ
fuser will not match mapped files, such as a process' shared libraries, if they're on a btrfs(5) filesystem. that's because the device IDs are different for stat(2) and /proc/<PID>/maps ๐
๐ฆ SEE ALSO ๐ฆ
kill(1), killall(1), stat(2), btrfs(5), lsof(8), mount_namespaces(7), pkill(1), ps(1), kill(2) ๐
that's the whole tea, bestie ๐ซถ psmisc 2022-11-02 FUSER(1) ๐โจ
๐ฆ where this page comes from
- alpine 3.22: psmisc-doc 23.7-r0 ยท GPL-2.0-or-later
- alpine 3.23: psmisc-doc 23.7-r0 ยท GPL-2.0-or-later
- alpine 3.24: psmisc-doc 23.7-r0 ยท GPL-2.0-or-later
- arch rolling: psmisc 23.7-2 ยท GPL
- debian trixie: psmisc 23.7-2 ยท GPL-2.0-or-later
- fedora 43: psmisc 23.7-6.fc43 ยท GPL-2.0-or-later
- fedora 44: psmisc 23.7-7.fc44 ยท GPL-2.0-or-later
- nixos 26.05: psmisc 23.7
- nixpkgs unstable: psmisc 23.7
- opensuse-leap 16.0: psmisc 23.7-160000.2.2 ยท GPL-2.0-or-later
- opensuse-leap 16.0: psmisc 23.7-160000.2.2 ยท GPL-2.0-or-later
- opensuse-leap 16.0: psmisc 23.7-160000.2.2 ยท GPL-2.0-or-later
- opensuse-leap 16.0: psmisc 23.7-160000.2.2 ยท GPL-2.0-or-later
- ubuntu noble: psmisc 23.7-1build1 ยท GPL-2.0-or-later
- ubuntu questing: psmisc 23.7-2ubuntu1 ยท GPL-2.0-or-later
- ubuntu resolute: psmisc 23.7-2ubuntu2 ยท GPL-2.0-or-later
- ubuntu stonking: psmisc 23.7-2ubuntu2 ยท GPL-2.0-or-later
- Copyright 1993-2005 Werner Almesberger
- ๐ girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms