Skip to main content

Module 6: User & Permission Management

Lesson 63: fuser Command

In this lesson, you'll learn how to use the fuser command to locate processes using specific files, directories, or sockets in Linux.

fuser is a simple yet powerful command-line utility intended to locate processes based on the files, directories, or sockets a particular process is accessing.

In short, it helps a system user identify processes using files or sockets.

fuser Command Syntax

The conventional syntax for using fuser is as follows:

# fuser [OPTIONS] [FILE|SOCKET]
# fuser [OPTIONS] -SIGNAL [FILE|SOCKET]
# fuser -l

fuser Command Options

Option Description
-v or --verbose Enable verbose output showing USER, PID, ACCESS, and COMMAND columns
-m NAME or --mount NAME Name all processes accessing a specific file or filesystem
-k or --kill Kill all processes accessing a file or socket
-i or --interactive Interactively confirm before killing each process
-l or --list-signals List all available signals that can be sent to processes
-SIGNAL Send a specific signal to matching processes

1. Find Which Process Is Accessing a Directory

Running the fuser command without any option will display the PIDs of processes currently accessing your current working directory.

$ fuser .

Or:

$ fuser /home/ubuntu
/home/ubuntu:  1234  1891  2045

For a more detailed and clear output, enable the -v or --verbose option as follows. In the output, fuser prints out the name of the current directory, then columns of the process owner (USER), process ID (PID), the access type (ACCESS), and command (COMMAND).

$ fuser -v .
                     USER        PID ACCESS COMMAND
/home/ubuntu:        ubuntu     1234 ..c..  bash
                     ubuntu     1891 ..c..  vim
                     ubuntu     2045 ..c..  python3

Under the ACCESS column, you will see access types signified by the following letters:

  • c - current directory
  • e - an executable file being run
  • f - open file (however, f is left out in the output)
  • F - open file for writing (F is also excluded from the output)
  • r - root directory
  • m - mmap'ed file or shared library
Pro TecMint Β· Root Plan
This Article is for Root Members
Join Root to read the full article and unlock everything

Full Access to Every Article, Course & Certification Track

Join thousands of Linux professionals who use Pro TecMint to advance their careers.

Ad-free access to all premium articles
All courses: Learn Linux, Bash, Golang, Ubuntu and more
RHCSA, RHCE, LFCS & LFCA certification prep
New courses added every month
Private Telegram community & priority support
Root Plan
$8/mo
or $59/year billed annually
Save $37 with annual plan
Start Reading This Article in the Next 60 Seconds
Join Root Plan β†’