Linux Fuser Command Help and Examples(What is, Concept and Definition)
On Unix-like operating systems, the fuser command identifies the processes that currently use files or sockets on the system.
This document describes the GNU/Linux version of the fuser .
Description
fuser displays the PIDs of the processes that use the specified files or file systems.
In the default display mode, each file name is followed by a letter indicating the type of access:
c | current directory. |
e | executable running. |
f | open file. f is skipped in the default display mode. |
F | open file for writing. F is ignored in the default display mode. |
r | root directory. |
m | mmap'ed file or shared library. |
fuser returns a non-zero return code if none of the specified files are accessed or in the event of a fatal error.minus one access, fuser returns zero.
To search for processes using TCP and UDP sockets, the corresponding namespace must be selected with the -n option.By default, fuser will be seen on IPv6 sockets and IPv4.To change the default behavior, use the -4 and -6 options.Sockets can be specified using the local and remote port, and the remote address.fields are optional, but commas before missing fields must be present:
[lcl_port] [, [rmt_host] [, [rmt_port]]]Symbolic or numeric values can be used for IP addresses and numbers port.
fuser just send the PIDs to stdout , everything else is sent to stderr.
Syntax
fuser [-fuv] [-a |-s] [-4 |-6] [-c |-m |-n space ] [-k [-i] [-M] [-w] [- SIGNAL ]] name ...fuser-l fuser-VOptions
-a , --all | Show all files specified on the command line.By default, only files accessed by at least one process are displayed. |
-c | Same as the -m option, used for POSIX compatibility. |
-f | Silently ignored, used for POSIX compatibility. |
-k , --kill | Kill processes access to the file.Unless changed with - SIGNAL , SIGKILL is sent. fuser never kills on its own, but it can kill other fuser processes.The effective user ID of the process running fuser is set to its ID of real user before trying to kill. |
-i , --interactive | Ask the user for confirmation before ending a process.This option is silently ignored if -k is not also present. |
-l , --list-signals | List all known signal names. |
-m NAME , --mount NAME | NAME specifies a file on a mounted file system or a block device that is mounted.All processes that access files on that file system are listed.specifies a directory file, it is automatically changed to NAME /.to use any file system that may be mounted in that directory. |
-M , --ismountpoint | The request will be fulfilled only if NAME specifies a mount point. This is an invaluable seat belt that prevents you from killing the machine if NAME is not a file system. |
-w | Kills only processes that have write access.This option is silently ignored if -k is not also present. |
-n SPACE , --namespace SPACE | Select a different namespace.The file namespaces (file names, the default), udp (local UDP ports), and tcp (local TCP ports) are supported.For ports, you can specify the port number or symbolic name.If there is no ambiguity, you can use the direct access notation name/space (for example , 80/tcp). |
-s , --quiet | Silent operation.-u and -v are ignored in this mode.-a should not be used with -s . |
-SIGNAL | Use the specified token instead of SIGKILL when killing processes.Tokens can be specified by name (for example, -HUP ) or by number ( for example, -1 ).This option is silently ignored if the -k option is not also present. |
-u , --user | Add the username of the process owner to each PID. |
-v , --verbose | Verbose mode.Processes are displayed in a similar style to ps.PID, USER, and COMMAND fields are similar to ps.ACCESS shows how the process accesses the file.Verbose mode will also display when accessed to a particular file as mount point, knfs export, or swap file, in this case the kernel is displayed instead of the PID. |
-V , --version | Show version information. |
-4 , --ipv4 | Search only IPv4 sockets.This option should not be used with the -6 option and only works with the tcp and udp namespaces. |
-6 , --ipv6 | Search only IPv6 sockets.This option should not be used with the -4 option and only works with the tcp and udp namespaces. |
- | Reset all options and reconfigure the token in SIGKILL . |
Examples
fuser.Shows each process ID that the current directory uses ("./").
fuser-v.Displays detailed information about each process that uses the current directory.This information includes the name of the user who started the process and an indicator of the name of the process.
fuser-v/Shows detailed information about each process that uses the root directory.
kill -It sends a signal to a process, affecting its behavior or killing it. pkill -Send a signal to any process whose attributes match a regular expression. ps : reports the status of a process or processes.
Comments
Post a Comment