Fuser: Represents a process with a file or a set of interfaces

Source: Internet
Author: User
Tags posix

Fuser: Represents a process with a file or a set of interfaces

function: The fuser command uses a file or a socket interface to represent the process.

Usage: fuser [-A |-S |-c] [-4 |-6] [-N space] [-K [-i] [-signal]] [-MUVF] name ...

or fuser-l

or fuser-v

The main options are as follows.

--a: Displays all files specified on the command line and, by default, files that are accessed by at least one process can be displayed.

--c: Same as option-M for compatibility with POSIX.

--F: Ignored for compatibility with POSIX.

I: Ask the user for comments before closing the process.

--k: Ends all processes that are accessing the file.

--l: Lists all known signal names.

--m: Mount the file system.

--n<space>: Select a different namespace, which refers to the file (the default is the file name), UDP, and TCP.

--s: Processing information is not displayed, options-u and-V are ignored in this mode, and option-a cannot be used with this option.

--signal: When you end a process with a specified signal instead of Sigkill, this option is ignored when option-K is not used.

--u PID: Displays the user name.

--V: Displays detailed information about the runtime.

--V: Displays version information.

Examples of applications are as follows.

(1) List all known signal names

# fuser-l

HUP INT QUIT ILL TRAP ABRT IOT BUS FPE KILL USR1 SEGV USR2 PIPE alrm term

Stkflt chld CONT STOP tstp ttin ttou URG xcpu xfsz vtalrm PROF WINCH IO PWR SYS

UNUSED

(2) Display process

For example, to display all processes related to the/home/cjh/directory, enter at a command prompt:

# fuser-a/HOME/CJH

/home/cjh:19169c 19197c

(3) End all processes that are accessing the file

For example, to end all processes that are accessing directory/home/cjh/tmp/, at a command prompt, enter:

#fuser-K/home/cjh/tmp/

/home/cjh/tmp/: 19169c

(4) Display user name

For example, show all processes that access directory/home/cjh/and display the user name of the process, and at the command prompt, enter:

# fuser-u/home/cjh/

/home/cjh/: 19245c (CJH)

(5) List the process number of the local process using the/etc/passwd file

#fuser/etc/passwd

(6) List all processes that are using files that have been deleted from a given file system

#fuser-d/usr

Fuser: Represents a process with a file or a set of interfaces

Related Article

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.