fuser is a command line utility in Linux. fuser can identify the process using the files or sockets. This command can be also used to kill the process. In this article, we are going to see how to use the fuser command to list the processes and kill the processes associated with files and directories. Let’s see how to use the fuser command.
Using fuser command
The syntax of the fuser command is very simple. The syntax of the fuser command is as follows:
fuser [options] [file|socket]
fuser [options] -SIGNAL [file|socket]
fuser -l
While using the fuser command, always mention the filename or path of the filename with the fuser command.
Find Which Process Accessing a Directory
To list out all processes associated with a file or directory, just mention the filename or path of the directory or file with the fuser command. Here is one example:
fuser.
Or
fuser ~/
These are the processes that are using the ~/ directory.
For verbose output, use -v
The output of the previous command will only show the PIDs of the process, which very little information. To get more information about the processes, use the -v or –verbose option with the fuser command:
fuser -v .
The output of the fuser command with the -v option is containing the following fields:
- USER:- user which owns the process.
- PID:- PID of the process.
- ACCESS:- Access type.
- COMMAND:- Command which using the mentioned file or folder.
In the ACCESS column, the access type is represented using the following letters:
- c :- represents the current directory.
- e :- The file is executable, and it is currently running.
- f :- open file. f is omitted in default display mode.
- F :- open file for writing. F is omitted in default display mode.
- r :- represents root directory.
- m :- mapped file or shared library.
- . :- Placeholder, omitted in default display mode.
Find Which Process Accessing A File System
To get the list of all processes which are using the file which is mentioned with the fuser command, use option -m or –mount. Here is one example:
fuser -v -m ~/.bashrc
Check processes using an executable
We can also check the process using the executable files. To find the process which is using the executable file, first, we need to find out the path of the executable. So to find the path of the executable we can use the ‘which’ command
$ which executable_name
Now we can use the path given by the ‘which’ command with the fuser command to find out the process associated with executable
In the above output, we can see the all process associated with the process spotify executable.
Kill Processes that are Using a particular Program
We can use the fuser command to kill the processes. To kill the process using the fuser command, use the option -k or –kill with the command and mention the path of the program.
sudo fuser -k
To kill a process interactively, use the option -i or –interactive with the above command. This command will ask while terminating each process.
sudo fuser -ki .
Sending a signal to process
We use the -k option to kill the process, then the SIGKILL is sent to the process. Now let’s see how to send other signals to process. First, to get a list of all available signals, use the following command:
To send the signal with the fuser command, mention the signal with – character after option -k
sudo fuser -k -SIGNAL
Check Processes Using TCP/UDP Sockets
By using the fuser command, we can also check which process is using the given TCP/UDP sockets. We have to use the -n option followed by the port number with the fuser command.
fuser -v -n tcp port_no
For example, we have one c program executable running on the port number 8080, and we have to find out which process uses the 8080 port, then we can use the following command
fuser -v -n tcp 8080
This is how we can use the fuser tool to manage processes. To know more about the fuser command, read the man page of the fuser.
man fuser

Similar Reads
du Command in LINUX
The du command in Linux is a powerful utility that allows users to analyze and report on disk usage within directories and files. Whether youâre trying to identify space-hogging directories, manage disk space efficiently, or simply gain insights into storage consumption, the du command provides valu
5 min read
Linux command in DevOps
DevOps engineers use Linux every day because itâs free, fast, and easy to customize. More importantly, most DevOps tools like Docker, Kubernetes, Ansible, Terraform, and Jenkins are built to run best on Linux. In DevOps, you often work on cloud servers (like AWS, Azure, or Google Cloud), and most of
9 min read
ls Command in Linux
The ls command is one of the most used commands in the Linux terminal to display the files and directories or path in the terminal. So, using the ls command is a basic skill for navigating the Linux file system, handling files, and managing directories. What is the ls Command in LinuxThe ls command
10 min read
Linux Commands
Linux commands are essential for controlling and managing the system through the terminal. This terminal is similar to the command prompt in Windows. Itâs important to note that Linux/Unix commands are case-sensitive. These commands are used for tasks like file handling, process management, user adm
15+ min read
grep command in Unix/Linux
The grep command in Unix/Linux is a powerful tool used for searching and manipulating text patterns within files. Its name is derived from the ed (editor) command g/re/p (globally search for a regular expression and print matching lines), which reflects its core functionality. grep is widely used by
7 min read
Unzip Command in Linux
As an open-source operating system, Linux presents plenty of powerful and versatile instructions for dealing with files and directories. One such command that performs an important role in coping with compressed files is the "unzip" command. Compressed files are a common way to keep space and share
8 min read
Chaining Commands in Linux
Chaining commands in Linux is a powerful technique that allows you to execute multiple commands sequentially or simultaneously through the terminal. This approach resembles writing short shell scripts that can be directly executed in the terminal, enhancing the efficiency of your workflow. By using
7 min read
expr command in Linux with examples
The expr command in Unix is a versatile tool used for evaluating expressions in the shell environment. It performs a wide range of functions, including arithmetic calculations, string operations, and comparisons based on regular expressions. What is the 'expr' Command?expr stands for "expression" an
3 min read
df Command in Linux with Examples
There might come a situation while using Linux when you want to know the amount of space consumed by a particular file system on your LINUX system or how much space is available on a particular file system. LINUX being command friendly provides a command line utility for this i.e. 'df' command that
9 min read
Kali Linux - Command Line Essentials
Command-line plays a vital role while working with Kali Linux as most of its tools don't have a Graphical User Interface and if you are performing ethical hacking or penetration testing then most of the time you will have to work with command Line Interface itself. While executing a command in Kali
5 min read