fuser Command Cheatsheet
The fuser command identifies the process IDs (PIDs) of processes that are using a specific file, directory, or socket. It's often used to determine why a file cannot be accessed or a filesystem cannot be unmounted.
Common Usage
| Command | Description |
|---|
fuser [FILE_PATH] | Lists the PIDs of processes using the specified file. |
fuser -k [FILE_PATH] | Kills all processes using the specified file. It sends a `SIGKILL` signal by default. |
fuser -u [FILE_PATH] | Lists the PIDs and usernames of processes using the specified file. |
fuser -n tcp [PORT] | Lists the PIDs of processes using a specific TCP port. For example, `fuser -n tcp 8080`. |
fuser -m [MOUNT_POINT] | Lists all processes using the specified filesystem or mount point. For example, `fuser -m /var`. |
Key `fuser` Flags
| Flag | Description |
|---|
-k | Sends a kill signal to the processes. You can specify a different signal with `-k -SIGNAL`. |
-i | Interactive mode. Asks for confirmation before killing a process. |
-u | Appends the username of the process owner to the output. |
-v | Verbose mode, providing a more detailed, `ps`-like output. |