psmisc proc file system utilities Snippets
List of Utilities
Section titled “List of Utilities”- fuser - Identifies processes using files or sockets
- killall - kills processes by name, e.g. killall -HUP named
- prtstat - prints statistics of a process
- pslog - prints log path(s) of a process
- pstree - shows the currently running processes as a tree
- peekfd - shows the data travelling over a file descriptor
fuser - identify processes using files or sockets
Section titled “fuser - identify processes using files or sockets”Source: Learn “fuser”, a little-known Linux workhorse command! - Veronica Explains - Youtube
Use case: find which processes are using files or sockets you are interested in, like files on a USB drive you want to eject
Called “F-user”
# Check process IDs holding a file/directoryfuser /media/user/my_folder
# Check process IDs, user, access type, and command using a file with verbose (-v)fuser -v ~/my_file
# Kill process IDs holding a file, good practice is check the processes first with fuser -vfuser -f ~/my_file
# Check mount point usage (-m or -c)sudo fuser -m -v /dev/sda1
# Check what is using a port with namespace (-n) and TCP followed by portfuser -v -n tcp 3000