fuser
PURPOSE
Identifies processes using a file or file structure.
DESCRIPTION
The fuser command lists, for local processes, the process
numbers of the processes using the specified local or
remote file. For remote processes that use local files,
fuser lists the node (NID) that has the files open. It
does not list the process numbers, user names, or usage
information. For block special devices, all processes
using any file on that device are listed. The process
number is followed by a letter indicating how the process
is using the file:
c Using file as the current directory
p Using file as the parent of the current directory
(only when in use by the system)
r Using file as the root directory.
The process numbers are written as a single line to
standard output, separated by spaces and ended with a
single new-line character. All other output is written
to standard error.
FLAGS
-k Sends the SIGKILL signal to each local process. Only
the person operating with superuser authority can kill
another user's process (see "kill"). SIGKILL is not
sent to remote processes.
-u Indicates the login name in parentheses after the
process number. The login name is not listed for
remote processes.
- Cancels any flags selected for the previous set of
file or files.
Flags may be respecified between groups of files on the
command line. The new set of flags replaces the old set.
EXAMPLES
1. To list the ID numbers of the processes using the
/etc/passwd file:
fuser /etc/passwd
2. To list the process IDs and user names of the proc-
esses using the /etc/filesystems file:
fuser -u /etc/filesystems
3. To stop all of the processes using a given disk
drive:
fuser -k -u /dev/hd1
This lists the process ID and user name, and then
stops each process that is using the "/dev/hd1" disk
drive. You must have superuser authority to stop
processes that belong to someone else. You might
want to do this if you are trying to unmount
"/dev/hd1", and a process accessing it is preventing
you from doing so.
4. To perform the actions of the previous examples in
reverse order:
fuser -k -u /dev/hd1 - -u /etc/filesystems - /etc/passwd
Note that lone dashes before the "-u" and before
"/etc/passwd" turn off both the "-k" and "-u" flags.
FILES
/unix System kernel image.
/dev/kmem For system image.
/dev/mem Also for system image.
RELATED INFORMATION
The following commands: "killall," "mount," and "ps."
The kill and signal system calls in AIX Operating System
Technical Reference.
"Using Distributed Services" in Managing the AIX Oper-
ating System.