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

  1. List processes:
ps aux
  1. Interactive monitor:
top
  1. Kill by PID:
kill 1234
  1. Kill by name:
killall firefox
  1. Change priority:
nice -n 10 ./script.sh

Tips

  • htop is a user-friendly alternative to top.
  • pgrep and pkill combine ps/kill with 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.