How to manage Linux processes
· Category: Linux
Short answer
Use ps, top, or htop to inspect processes; use kill, killall, or nice to control them.
Steps
- List processes:
ps aux
- Interactive monitor:
top
- Kill by PID:
kill 1234
- Kill by name:
killall firefox
- Change priority:
nice -n 10 ./script.sh
Tips
htopis a user-friendly alternative totop.pgrepandpkillcombineps/killwith pattern matching.kill -9(SIGKILL) is forceful; prefer-15(SIGTERM) first.
Common issues
- Zombie processes: cannot be killed; the parent must reap them.
- Permission denied: you cannot kill processes owned by other users without root.