fuser
Processes and system
Usage
fuser <file> | fuser <port>/tcpFinds, and if you ask kills, whatever is using a file, a mount point or a port; `-k` sends SIGKILL with no chance to clean up, and it exists only on Linux (psmisc) since the macOS version has just `-cfu`.
Common flags
| Flag | Meaning |
|---|---|
| 3000/tcp | PIDs using that TCP port (Linux). |
| -k | Kill those processes. Sends SIGKILL, so no cleanup. Linux only; macOS fuser has no -k. |
| -i | Ask before each kill, and only useful together with -k. |
| -v | A readable table with user, PID and access type. |
| -m <mount> | Every process using anything on that filesystem, before you unmount it. |
| -c / -f / -u | The only options POSIX guarantees, and all that macOS supports. |
Examples
fuser 3000/tcpWhich PID is holding the port (Linux).
fuser -k -i 3000/tcpKill the holder, asking first (Linux).
fuser -vm /mnt/dataFind out why the filesystem says "device is busy".
What is running and what is eating the machine. Identifying it comes before killing it.
How to read this
- Square brackets [ ] mark a part you may leave out.
- An ellipsis … means you can list more than one.
- Flags are case-sensitive — in some commands -r and -R do different things.
Questions
Q. What does fuser do?
Finds, and if you ask kills, whatever is using a file, a mount point or a port; `-k` sends SIGKILL with no chance to clean up, and it exists only on Linux (psmisc) since the macOS version has just `-cfu`.
Q. How do I type it?
fuser <file> | fuser <port>/tcp — square brackets mark the parts you can leave out.
Q. How many flags are worth knowing?
6 are listed here; the full set is in man fuser. This command sits under Processes and system.
Related commands
man page: man fuser