fuser

QNX SDP8.0Utilities ReferenceUtilities

List the process IDs of all processes that have one or more files open (POSIX)

Syntax:

fuser [-cfsu] file...

Runs on:

QNX OS

Options:

-c
Treat the file as a filesystem mountpoint and report on any files open in the filesystem.
-f
Operate only on the named files (affects block-special).
-s
(QNX OS extension) Operate silently; return the indication of open files in the exit status.
-u
Display the user name of each process.

Description:

The fuser utility writes to standard output the process IDs of processes running on the local system that have one or more named files open. For block special devices, all processes using any file on that device are listed.

This utility writes to standard error additional information about the named files indicating how the file is being used:
  • The pathname of each named file is written followed immediately by a colon.
  • For each process ID written to standard output, fuser writes whichever of the following characters apply:
    This character: Indicates that:
    o (QNX OS extension) The process has the file open
  • If you specified the -u option, the name of the process's real user ID is written in parentheses. If the user name can't be determined, the process's real user ID is written instead.

When standard output and standard error are directed to the same file, the output is interleaved so that the filename appears at the start of each line, followed by the process ID and characters indicating the use of the file. Then, if you specified the -u option, the user name or user ID for each process using that file is written.

A newline character is written to standard error after the last output described above for each file operand.

Examples:

Suppose that /q6 is mounted on /dev/hd0t178 and has a process with an open file /q6/Z:
This command: Gives this output: Because:
fuser /q6 /q6: Nothing has /q6 (a directory) directly open
fuser -c /q6 /q6: 811026o The file is inside the /q6 filesystem
fuser /dev/hd0t178 /dev/hd0t178: 811026o The file is inside the filesystem mounted on the (block) hd0t178
fuser -f /dev/hd0t178 /dev/hd0t178: The -f option indicates that you want to treat hd0t178 as the target file directly
fuser /q6/Z /q6/Z: 811026o You specified a file; in this case, it doesn't matter if you specify -c or -f

Exit status:

0
Success.
>0
An error occurred or some open files were found.
Page updated: