What I Wanted to Do
A process was hanging and I needed to identify and kill it without rebooting the server.
Check Running Processes
ps aux # List all processes
ps aux | grep nginx # Filter by process name
top # Real-time monitor (press q to quit)
Kill a Process
kill PID # Request graceful shutdown
kill -9 PID # Force kill
pkill nginx # Kill by process name
Find Which Process Is Using a Port
lsof -i :8080
ss -tlnp | grep 8080
Common Pitfalls
- If
killalone doesn’t work, usekill -9— but treat it as a last resort - For services like nginx or Docker, using
systemctl stopis safer than killing the process directly
For managing services via systemd, see Manage Services with systemd (start/stop/enable/status).
Related Posts
- Linux Basic Commands (ls/cd/mkdir/rm)
- Linux File Permissions Explained (chmod/chown)
- How to Fix “Permission Denied” on Linux
- Install WSL2 on Windows
Recommended Cloud Hosting
Looking for reliable cloud infrastructure? Check out these developer-friendly services.
- Cherry Servers - High-performance VPS and dedicated servers
- Cloudways - Managed cloud hosting for developers