fuser Linux Command Made Simple: Step-by-Step Guide 2025

fuser linux

Table of Contents

Get up to 50% off now

Become a partner with CyberPanel and gain access to an incredible offer of up to 50% off on CyberPanel add-ons. Plus, as a partner, you’ll also benefit from comprehensive marketing support and a whole lot more. Join us on this journey today!

The fuser Linux command is an amazing tool that helps you identify which process is using a specific file, directory, or socket. It also gives details about the user who owns the running process and the kind of access they have.

So This is a complete guide i’m telling you what a Linux Fuser command is, the syntax, an options table, and examples to learn in 2025. So let’s dive in!

What is Fuser Linux?

The fuser Linux command is a utility available in the Linux command line. It is capable of identifying processes that are utilizing specific files or sockets.

The Linux fuser command outputs the process IDs of all processes on the local system that have one or more specified files open. The file refers to the path name of the file for which details are to be provided, or if the -c option is used, it refers to a file on the file system for which details are to be provided. Additionally, it sends extra information to standard error, including the user name of the process and a character that shows how the process is interacting with the file.

fuser Linux Command Syntax

The basic syntax for using fuser is:

fuser [options] [file|socket]
fuser [options] -SIGNAL [file|socket]
fuser -l 

Here’s a tip: While using the fuser Linux command, always mention the filename or path of the filename with the fuser command.

Tech Delivered to Your Inbox!

Get exclusive access to all things tech-savvy, and be the first to receive 

the latest updates directly in your inbox.

Output:

<br><br>No process specification given<br>Usage: fuser [-fMuv] [-a|-s] [-4|-6] [-c|-m|-n SPACE] [-k [-i] [-SIGNAL]] NAME...<br>       fuser -l<br>       fuser -V<br>Show which processes use the named files, sockets, or filesystems.<br><br>  -a,--all              display unused files too<br>  -i,--interactive      ask before killing (ignored without -k)<br>  -k,--kill             kill processes accessing the named file<br>  -l,--list-signals     list available signal names<br>  -m,--mount            show all processes using the named filesystems or block device<br>  -M,--ismountpoint     fulfill request only if NAME is a mount point<br>  -n,--namespace SPACE  search in this name space (file, udp, or tcp)<br>  -s,--silent           silent operation<br>  -SIGNAL               send this signal instead of SIGKILL<br>  -u,--user             display user IDs<br>  -v,--verbose          verbose output<br>  -w,--writeonly        kill only processes with write access<br>  -V,--version          display version information<br>  -4,--ipv4             search IPv4 sockets only<br>  -6,--ipv6             search IPv6 sockets only<br>  -                     reset options<br><br>  udp/tcp names: [local_port][,[rmt_host][,[rmt_port]]]

Options For The fuser in Linux Command

OptionDescription
-aShow all files specified on the command line. By default, only files accessed by at least one process are shown.
-cSame as -m; kept for POSIX compatibility.
-fIgnored silently (POSIX compatibility).
-kKill processes accessing the file. Sends SIGKILL by default unless another signal is specified. fuser never kills itself but may kill other fuser processes.
-iAsk for confirmation before killing a process (used with -k).
-lList all known signal names.
-mShow all processes accessing files on a mounted filesystem or block device. If a directory is given, it is expanded to include any filesystem mounted there.
-n spaceSelect a different namespace: file (default), tcp, or udp. Can use shorthand (e.g., 80/tcp).
-sSilent mode. Ignores -u and -v. Cannot be combined with -a.
-signalSend a specified signal instead of SIGKILL when killing processes. Signals can be by name (e.g., -HUP) or number (e.g., -1). Requires -k.
-uAppend the username of the process owner to each PID.
-vVerbose mode, ps-like output. Shows PID, USER, COMMAND, and ACCESS. If accessed by the kernel, kernel is shown.
-VDisplay version information.
-4Search only for IPv4 sockets (only valid with tcp and udp, not with -6).
-6Search only for IPv6 sockets (only valid with tcp and udp, not with -4).
Reset all options and restore default SIGKILL for killing.

Practical Examples of fuser Linux

1. Find which process is using a file

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

2. Check which process is using a port

You might also want to research processes that use TCP and UDP sockets. To illustrate this example, start by using nc to set up a TCP listener on port 8002, which will allow you to observe a running process:

nc -l -p 8002

This command will keep the terminal busy while it runs. In a different terminal window, use fuser with the -n option to identify the process operating on TCP port 8002:

fuser -v -n tcp 8002

Output

USER PID ACCESS COMMAND<br>8002/tcp: sammy 17985 F. nc<br>Note: The fuser tool checks both IPv4 and IPv6 sockets by default, but you can specify -4 or -6 to limit the check to only IPv4 or IPv6 connections, respectively.

The output indicates that the process ID (PID) for the netcat process is 17985, and the command used to start it is ‘nc’. You can use the PID in various ways, such as stopping or terminating a running process. For more information on process management, refer to How to Use ps, kill, and nice to Manage Processes in Linux. Additionally, you can use fuser to terminate processes on specific ports by adding the -k flag:

fuser -k 8002/tcp

Output

8002/tcp: 18056

If you return to your first terminal window, you will see that the nc program has been terminated and control has returned to the shell.

The fuser utility can also send specific signals to a process. When you use the -k option, the fuser command sends a KILL signal to the process. Many other signals can be sent to a running process. You can view these signals by using fuser -l:

fuser -l

Output

Enhance Your CyerPanel Experience Today!
Discover a world of enhanced features and show your support for our ongoing development with CyberPanel add-ons. Elevate your experience today!

HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT<br>CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH POLL PWR SYS

3. Kill processes with fuser

To terminate all processes that are using a file or socket, utilize the -k or –kill option.

sudo fuser -k .

To kill a process interactively, where you will be prompted to confirm your decision to terminate the processes accessing a file or socket, use the -i or –interactive option.

sudo fuser -ki .<br>

The two commands mentioned above will terminate all processes that are using your current directory; the default signal sent to these processes is SIGKILL, unless -SIGNAL is specified.

4. List All Signals Available in Linux

You can list all the signals using the -l or –-list-signals options as below.

sudo fuser --list-signals <strong><br></strong>

Summary

The fuser Linux command might not be as widely used as other commands, but it is a very powerful tool for system administrators and developers.

Whether you are troubleshooting file access problems, identifying which processes are using a network port, or safely terminating processes that hinder your work, fuser offers clear visibility and control.

By understanding its options and using it in practical situations, you can save time, enhance security, and manage system resources more efficiently. Mastering the fuser equates to mastering another crucial aspect of Linux administration.

FAQ’s

What is the fuser command in Linux for?

A Fuser Linux Comman will show you which processes are using a file, directory, or network port.

How does fuser differ from lsof?

fuser in Linux is quicker and displays process IDs, while lsof provides more detailed information about open files.

Is it possible to terminate processes with fuser?

Yes, you can use fuser -k to terminate processes. Add -i for a confirmation prompt before termination.

Is the fuser Linux found on all Linux distributions?

Yes, fuser is included in the psmisc package, which is available by default on most Linux distributions.

Can fuser identify which process is using a port?

Yes, use this command: fuser -n tcp

Areeba Nauman
Areeba is a Content Writer with expertise in web content and social media, she can simplify complex concepts to engage diverse audiences. Fueled by creativity and driven by results, she brings a unique perspective and a keen attention to detail to every project she undertakes with her creativity and passion for delivering impactful content strategies for success. Let's connect on Linkedin: https://www.linkedin.com/in/areeba-bhatti/
Unlock Benefits

Become a Community Member

SIMPLIFY SETUP, MAXIMIZE EFFICIENCY!
Setting up CyberPanel is a breeze. We’ll handle the installation so you can concentrate on your website. Start now for a secure, stable, and blazing-fast performance!