SHARE
Facebook X Pinterest WhatsApp

fuser, files, and processes

Written By
thumbnail Juliet Kemp
Juliet Kemp
Jul 20, 2010
ServerWatch content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More



Juliet Kemp

Sometimes you may want to know which process is accessing a particular file
or filesystem — for example, if you get a “device is busy” error message.
fuser will provide this information.

Tip of the Trade: Because sometimes you need to know which process is accessing a particular file or filesystem.

Basic usage is: fuser filename.txt, which will give you this
output:

/home/juliet/filename.txt: 13644

That number is the ID of the process that’s accessing the file. Use fuser -u filename.txt to see which user owns the process:

/home/juliet/filename.txt: 13644(juliet)

For more information, use fuser -v filename.txt:

                     USER        PID ACCESS COMMAND
/home/juliet/filename.txt:
                     juliet    13644 f.... more

This shows the user and PID, as well as information about how
the file is being accessed (here, f, indicating an open file), and the command being used
to access it (here, more).

The -m switch shows all process accessing the filesystem, which the
file is on; or you can simply specify a filesystem rather than a file. So
fuser -m /dev/sdb1 output looks like:

/dev/sdb1: 18647c 16875m  7122c 19579m  1606c  7258c  5760c 13644c

Most of these processes are accessing the current
directory (c), with a couple using shared libraries (m). Use the -v switch, to get more information.

To kill all processes accessing a particular file, use fuser -k
filename.txt
(add -i for a confirmation message before each
kill). You can also use fuser on network ports: fuser -n tcp 21. This will show which process is using port 21 (useful if you get
a ‘port busy’ message).

thumbnail Juliet Kemp

Juliet Kemp is a ServerWatch contributor.

Recommended for you...

What Is a Container? Understanding Containerization
What Is a Print Server? | How It Works and What It Does
Nisar Ahmad
Dec 8, 2023
What Is a Network Policy Server (NPS)? | Essential Guide
Virtual Servers vs. Physical Servers: Comparison and Use Cases
Ray Fernandez
Nov 14, 2023
ServerWatch Logo

ServerWatch is a top resource on servers. Explore the latest news, reviews and guides for server administrators now.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.