Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

fuser (Unix)

From Wikipedia, the free encyclopedia
icon
This articleneeds additional citations forverification. Please helpimprove this article byadding citations to reliable sources. Unsourced material may be challenged and removed.
Find sources: "Fuser" Unix – news ·newspapers ·books ·scholar ·JSTOR
(January 2021) (Learn how and when to remove this message)
fuser
Example usage offuser
Operating systemUnix andUnix-like
PlatformCross-platform
TypeCommand

TheUnixcommandfuser is used to show whichprocesses are using a specifiedcomputer file,file system, orUnix socket.

Example

[edit]

For example, to check process IDs and users accessing a USB drive:

$fuser-m-u/mnt/usb1/mnt/usb1:   1347c(root)  1348c(guido)  1349c(guido)

The command displays theprocess identifiers (PIDs) of processes using the specified files or filesystems. In the default display mode, each PID is followed by aletter denoting the type of access:

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

Only the PIDs are written tostandard output. Additional information is written to standard error. This makes it easier to process the output with computer programs.

The command can also be used to check what processes are using a network port:

$fuser-v-ntcp80                     USER        PID ACCESS COMMAND80/tcp:              root       3067 F.... (root)httpd                     apache     3096 F.... (apache)httpd                     apache     3097 F.... (apache)httpd

The command returns a non-zero code if none of the files areaccessed or in case of a fatal error. If at least one access has succeeded, fuser returns zero. The output of "fuser" may be useful in diagnosing "resource busy" messages arising when attempting tounmount filesystems.

Options

[edit]

POSIX defines the following options:[1]

-c
Treat the file as amount point.
-f
Only report processes accessing the named files.
-u
Append user names in parentheses to each PID.

psmisc adds the following options, among others:[2]

-k,--kill
Kill all processes accessing a file by sending aSIGKILL. Use e.g.-HUP or-1 to send a differentsignal.
-l,--list-signals
List all supported signal names.
-i,--interactive
Prompt before killing a process.
-v,--verbose
verbose mode
-a,--all
Display all files. Without this option, only files accessed by at least one process are shown.
-m,--mount
Same as-c. Treat all following path names as files on amounted file system orblock device. All processes accessing files on that file system are listed.

Related commands

[edit]
  • The list of all open files and the processes that have them open can be obtained through thelsof command.
  • The equivalent command onBSD operating systems isfstat(1).

References

[edit]
  1. ^fuser – Shell and Utilities Reference,The Single UNIX Specification, Version 5 fromThe Open Group. Retrieved December 4, 2020.
  2. ^"fuser.1"(troff with man macros).GitLab. September 9, 2020.Archived from the original on April 7, 2022. RetrievedDecember 4, 2020.

External links

[edit]
The WikibookGuide to Unix has a page on the topic of:Commands

fuser – Shell and Utilities Reference,The Single UNIX Specification, Version 5 fromThe Open Group

File system
Processes
User environment
Text processing
Shell builtins
Searching
Documentation
Software development
Miscellaneous


Stub icon

ThisUnix-related article is astub. You can help Wikipedia byadding missing information.

Retrieved from "https://en.wikipedia.org/w/index.php?title=Fuser_(Unix)&oldid=1336328302"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp