• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

fuser Command Examples in Linux

by admin

The fuser command is useful to determine which files are using system resources. One of the more common uses of this command is to determine which user is active in a filesystem, which prevents the system administrator from unmounting the filesystem:

[root@localhost ~]# umount /boot
umount: /boot: target is busy.
(In some cases useful info about processes that use the device is found by lsof(8) or fuser(1))
[root@localhost ~]# fuser -v /boot
          USER        PID ACCESS  COMMAND
/boot:    root        kernel      mount /boot
          student     29306       ..c.. bash

fuser output will include following symbols:

c      current directory.
e      executable being run.
f      open file. f is omitted in default display mode.
F      open file for writing. F is omitted in default display mode.
r      root directory.
m      mmap'ed file or shared library. 

The following table describes common options for the fuser command:

Option Description
-k or –kill Kill the process that is using the filesystem or resource.
-i or –interactive Prompt before killing the process (you must also use the -k option).
-v or –verbose Verbose; produce additional useful information.

fuser Command Examples

1. To get the process using root file system:

# fuser / 

2. To show all files specified on the command line:

# fuser -a / 

3. To kill the processes accessing the files:

# fuser -k /tmp 

4. To ask the user before kill the process:

# fuser -ki /tmp 

5. To list all the known signal:

# fuser -l 

6. To list all processes of the mount point in which the given file is residing:

# fuser -m /tmp/file.txt 

7. For silent operation:

# fuser -s /tmp 

8. To specify the signal instead of SIGKILL:

# fuser -signal 15 /tmp 

9. To get the user name of the process owner:

# fuser -u /tmp 

10. To set the verbose mode:

# fuser -v 

11. To display the version information:

# fuser -V 

12. To search for only IPv4 sockets:

# fuser -4 /tmp 

13. To search for only IPv6 sockets:

# fuser -6 /tmp 

14. To reset the all the signal options:

# fuser - 

Final Thoughts

fuser command identifies and outputs the process IDs of processes that are using the files or local filesystems. Each process ID is followed by a letter code: c if process is using file as the current directory; e if executable; f if an open file; F if open file for writing; m if a shared library; and r if the root directory. Any user with permission to read /dev/kmem and /dev/mem can use fuser, but only a privileged user can terminate another user’s process. fuser does not work on remote (NFS) files.

Filed Under: Linux

Some more articles you might also be interested in …

  1. CentOS / RHEL : How to create new LVM based swap partition
  2. smbpasswd: command not found
  3. rpcinfo: command not found
  4. kdocker: command not found
  5. sed Command Examples in Linux
  6. choose: A human-friendly and fast alternative to cut and (sometimes) awk
  7. fastfetch: A CLI tool to display information about your operating system, software and hardware
  8. How to find docker storage device and its size (device mapper storage driver)
  9. ceph: command not found
  10. netselect Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright