Process & Resource Monitoring (Top/Htop/Ps/Systemd)
Stop getting “device busy” errors that make no sense
🧩 The Challenge
Ever tried to unmount a filesystem and got “device or resource busy”? Or maybe you’re trying to restart a web app, but its port is “already in use”, and you can’t figure out who’s holding it hostage? It’s the kind of cryptic error message that used to drive me absolutely nuts for hours.
💡 The Fix
You don’t need to hunt blindly or resort to rebooting the machine just because a service won’t let go of a resource. There’s a simple command that shows you exactly what process has a particular file or network port open, saving you a ton of guesswork.
lsof -i :80
lsof +D /mnt/data
⚙️ Why It Works
What this command does is list *all* open files, including network sockets. The first example quickly shows you exactly which process has port 80 open, whether it’s actively listening or just hanging around. The second recursively lists every process currently holding a file handle open on /mnt/data, which is how you figure out who’s keeping that filesystem busy.
🚀 Pro-Tip: Pipe the output of lsof to awk ‘{print $2}’ | sort -u to get just the PIDs, then kill ’em if you need to.
Linux Tips & Tricks | © ngelinux.com | 9/26/2026
