1. Home
  2. Tutorials
  3. How To Use the Linux Fuser Command

How To Use the Linux Fuser Command

How To Use the Linux Fuser Command
How To Use the Linux Fuser Command

In this guide we are going to show you how to use the Linux Fuser command, the fuser command is usually used to help identify what processes are using a specific file, unix socket or file system. In this guide we plan to teach you a couple examples on how you can use the fuser command on a Linux VPS.

In order to be able to run fuser commands, you will require SSH access to the server. Connect to your server via SSH and run fuser.

# fuser

No process specification given

Usage: fuser [-fMuvw] [-a|-s] [-4|-6] [-c|-m|-n SPACE] [-k [-i] [-SIGNAL]] NAME...

fuser -l

fuser -V

Show which processes use the named files, sockets, or filesystems.

-a,--all              display unused files too

-i,--interactive      ask before killing (ignored without -k)

-k,--kill             kill processes accessing the named file

-l,--list-signals     list available signal names

-m,--mount            show all processes using the named filesystems or block device

-M,--ismountpoint     fulfill request only if NAME is a mount point

-n,--namespace SPACE  search in this name space (file, udp, or tcp)

-s,--silent           silent operation

-SIGNAL               send this signal instead of SIGKILL

-u,--user             display user IDs

-v,--verbose          verbose output

-w,--writeonly        kill only processes with write access

-V,--version          display version information

-4,--ipv4             search IPv4 sockets only

-6,--ipv6             search IPv6 sockets only

-                     reset options

udp/tcp names: [local_port][,[rmt_host][,[rmt_port]]]

This output should notify you that no process specification is provided and is going to give you some basic usage examples and options.

The –v or –verbose gives a verbose output and it is used commonly. One example is to list every process which uses the current directory.

fuser -v .

In case your current directory is the root directory, you will receive an output similar to the one below:

# fuser -v .


root         37 .rc.. bash

root         64 .rc.. systemd-journal

root         65 .rc.. systemd-udevd

root        193 .rc.. rpcbind

root        197 .rc.. systemd-logind

root        199 .r... cron

messagebus  200 .rc.. dbus-daemon

syslog      211 .rc.. rsyslogd

root        296 .r... saslauthd

root        297 .r... saslauthd

root        299 .rc.. sshd

bind        304 .r... named

root        321 .r... dovecot

root        329 .r... log

root        334 .r... config

mysql       336 .r... mysqld

root        370 .rc.. agetty

root        371 .rc.. agetty

root        396 .rc.. xinetd

root        429 .r... sendmail-mta

root        449 .rc.. apache2

www-data    455 .rc.. apache2

www-data    456 .rc.. apache2

www-data    457 .rc.. apache2

www-data    458 .rc.. apache2

www-data    459 .rc.. apache2


In the output above you will see information such as the USER, PID, ACCESS and the COMMAND which was used to initiate the procedure. ACCESS reveals letters denoting the type of access and there are multiple ones:

c - current directory

e - executable being run

r - root directory

f - open file (omitted in default display mode)

F - open file for writing (omitted in default display mode)

m - mmap’ed file or shared library

A different usage for fuser is to list every process which uses UDP and TCP sockets on your Linux VPS. As an example, we will list every process which uses the TCP port 80, you may run the command below for that:

fuser -v -n tcp 80

In case you have Apache installed and running on your server, you will receive an output similar to the following:

# fuser -v -n tcp 80


80/tcp:              root        449 F.... apache2

www-data    455 F.... apache2

www-data    456 F.... apache2

www-data    457 F.... apache2

www-data    458 F.... apache2

www-data    459 F.... apache2

www-data    511 F.... apache2

www-data    512 F.... apache2

www-data    513 F.... apache2

Fuser could be used to destroy particular processes as well. For example, to kill the processes which are using the TCP port 80, we will use the command below:

fuser -k 80/tcp

Keep in mind that this is going to kill your Apache service if it happens to run currently.

A different example is to kill every process which accesses the /home directory in any way:

fuser -km /home

For more options and usage examples you may refer to the fuser main page.

man fuser
Updated on March 8, 2018

Was this article helpful?

Related Articles

Add A Comment