The Unix command fuser is used to show which processes are using a specified file, file system, or unix socket. For example, to check process IDs and users accessing a USB drive:
Contents
The command displays the process identifiers of processes using the specified files or file systems. In the default display mode, each file name is followed by a letter denoting the type of access:
The command can also be used to check what processes are using a network port:
The command returns a non-zero code if none of the files are accessed 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 to unmount filesystems.
Options
Also, note that -k sends a SIGKILL to all process. Use the -signal to send a different signal. For a list of signals supported by the fuser run 'fuser -l'