NAME

fuser — list process IDs of all processes that are using one or more named files

SYNOPSIS

[XSI] [Option Start] fuser [-cfu] file... [Option End]

DESCRIPTION

For each file operand, in order, fuser shall write one line of output, some of it to standard output, and the rest to standard error, giving information about processes running on the local system that are using the file. A process shall be considered to be using a file if it has at least one open file descriptor associated with the file or if the file is a directory that is the current working directory or the root directory for the process, and may be considered to be using a file for other implementation-dependent reasons. If file names a block special device that contains a mounted file system, and the -f option is not specified, any processes using any file on that mounted file system and any processes that are using the device file itself shall be listed.

Any output for processes running on remote systems that are using a named file is unspecified.

A user may need appropriate privileges to invoke the fuser utility.

When standard output and standard error are directed to the same file, the output for each file operand shall be interleaved so that it is written to the file in the following order:

When standard output and standard error are not directed to the same file, the data written to each shall be as described above but the ordering of writes to standard output relative to writes to standard error is unspecified. For example, fuser might first write the information for all file operands to standard error and then write all of the process IDs to standard output.

OPTIONS

The fuser utility shall conform to XBD 12.2 Utility Syntax Guidelines .

The following options shall be supported:

-c
If a file operand names a directory that is the mount point of a mounted file system, all processes using any file on that file system shall be listed as if they were using the named directory. The behavior for any file operand that names an existing file that is not the mount point of a mounted file system is unspecified.
-f
The report shall be only for the named files.
-u
The user name, in parentheses, associated with each process ID written to standard output shall be written to standard error.

OPERANDS

The following operand shall be supported:

file
A pathname of a file for which the processes using the file are to be reported.

STDIN

Not used.

INPUT FILES

The user database.

ENVIRONMENT VARIABLES

The following environment variables shall affect the execution of fuser:

LANG
Provide a default value for the internationalization variables that are unset or null. (See XBD 8.2 Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.)
LC_ALL
If set to a non-empty string value, override the values of all the other internationalization variables.
LC_CTYPE
Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments).
LC_MESSAGES

Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
NLSPATH
Determine the location of messages objects and message catalogs.

ASYNCHRONOUS EVENTS

Default.

STDOUT

See DESCRIPTION.

STDERR

The fuser utility shall write diagnostic messages to standard error.

The fuser utility also shall write information to standard error as specified in the DESCRIPTION section.

OUTPUT FILES

None.

EXTENDED DESCRIPTION

None.

EXIT STATUS

The following exit values shall be returned:

 0
Successful completion.
>0
An error occurred.

CONSEQUENCES OF ERRORS

Default.


The following sections are informative.

APPLICATION USAGE

Things can change while fuser is running; the snapshot it gives is only true for an instant, and might not be accurate by the time it is displayed.

EXAMPLES

The command:

fuser -fu .

writes to standard output the process IDs of processes that are using the current directory and writes to standard error an indication of how those processes are using the directory and the user names associated with the processes that are using the current directory.

fuser -c <mount point>

writes to standard output the process IDs of processes that are using any file in the file system which is mounted on <mount point> and writes to standard error an indication of how those processes are using the files.

fuser <mount point>

writes to standard output the process IDs of processes that are using the file which is named by <mount point> and writes to standard error an indication of how those processes are using the file.

fuser <mounted block device>

writes to standard output the process IDs of processes that are using any file on the mounted file system contained by <mounted block device> and of processes that are using the device file <mounted block device> itself, and writes to standard error an indication of how those processes are using the files.

fuser -f <mounted block device>

writes to standard output the process IDs of processes that are using the file <mounted block device> itself and writes to standard error an indication of how those processes are using the file.

RATIONALE

The definition of the fuser utility follows existing practice.

FUTURE DIRECTIONS

If this utility is directed to display a pathname that contains any bytes that have the encoded value of a <newline> character when <newline> is a terminator or separator in the output format being used, implementations are encouraged to treat this as an error. A future version of this standard may require implementations to treat this as an error.

SEE ALSO

XBD 8. Environment Variables , 12.2 Utility Syntax Guidelines

CHANGE HISTORY

First released in Issue 5.

Issue 7

SD5-XCU-ERN-90 is applied, updating the EXAMPLES section.

SD5-XCU-ERN-97 is applied, updating the SYNOPSIS.

Issue 8

Austin Group Defect 251 is applied, encouraging implementations to report an error if a utility is directed to display a pathname that contains any bytes that have the encoded value of a <newline> character when <newline> is a terminator or separator in the output format being used.

Austin Group Defect 1122 is applied, changing the description of NLSPATH .

Austin Group Defect 1746 is applied, clarifying the output written to standard output and standard error.

End of informative text.