Fuser command Summary

Source: Internet
Author: User
Fuser Overview

The Fuser command is used to display information about all processes that are using the specified file, file system, or sockets.

Example 1:

# Fuser-m-u/mnt/usb1
/Mnt/usb1: 1347c (Root) 1348c (Guido) 1349c (Guido)

In example 1, the-M and-u options are used to find the owner of all processes that are using/mnt/usb1, such as 1347c (Root ), among them, 1347 is the process PID and root is the owner of the process.

Fuser displays the PID of the process using the specified file, file system, or sockets. In the default display mode, each file name follows a character to indicate the current access type.

As follows:

C Current directory. e executable being run. f Open file. f Open File for writing. r root directory. m MMAP 'ed file or shared library

At the same time, Fuser can be used to find which processes are using the specified network port.

[[Email protected]/] # Fuser-v-n tcp 111

User PID access command
111/tcp: RPC 2848 f... Portmap

Fuser return value:

If Fuser does not find any process that is using the specified file, filesystem, or socket, or a fatal error occurs during the search, the non-zero value is returned.

Fuser returns zero if it finds at least one process is using the specified file, filesystem, or socket.

Common scenarios of Fuser

Fuser is usually used to diagnose the system's "resource busy" problem. It is usually encountered when you want umount to specify the mount point. If you want to kill all processes that are using a specified file, file system or sockets, you can use-K option.

Fuser-K/Path/to/Your/filename

At this time, the fuser will send sigkill to the process that is using/path/to/Your/filename. If you want to receive a prompt before sending the message, you can use the-I option.

Fuser-k-I/Path/to/Your/filename

Other useful parameters of Fuser
-K
Kills all process accessing a file. For example Fuser-k/path/to/Your/filenameKills all processes accessing this directory without confirmation. Use-I for confirmation
-I
Interactive Mode. Prompt before killing Process
-V
Verbose.
-U
Append Username
-
Display All files
-M
NameSpecifies a file on a mounted file system or a block device that is mounted. All processes accessing files on that file system are listed. If a directory file is specified, it is automatically changed Name/. To use any file system that might be mounted on that directory.
Refer:

[1] MAN Fuser

[2] http://en.wikipedia.org/wiki/Fuser_%28Unix%29

Reprinted: http://www.cnblogs.com/yuboyue/archive/2011/07/18/2109838.html

Fuser command Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.