Skip to content
# Process & service management

Viewing and managing processes

Inspect what's running with ps and top/htop, and stop misbehaving processes with kill.

List running processes

ps aux shows every process on the system in a flat list; ps -ef is the equivalent in a different (POSIX) format. Both are available on every distro with no install.

bash
ps aux
ps aux | grep nginx
pgrep -a nginx

Live view: top and htop

top ships everywhere and shows CPU/memory usage updating in place. htop is a nicer, color, scrollable version but needs installing first.

bash
top
sudo apt install htop   # Ubuntu/Debian; dnf/zypper/pacman/apk install htop elsewhere
htop

Stop a process

kill sends a signal by PID; SIGTERM (the default, 15) asks the process to shut down cleanly, SIGKILL (9) forces it immediately and should be a last resort since it skips any cleanup. killall targets by process name instead of PID.

bash
kill 1234          # SIGTERM: ask it to stop
kill -9 1234        # SIGKILL: force it
killall node

Priority: nice and renice

nice starts a new process with a given priority (-20 highest, 19 lowest, default 0); renice changes the priority of a process that's already running.

bash
nice -n 10 ./backup.sh
renice -n 10 -p 1234