Updated: 30 September 2026 · Applies to: procps and htop on Ubuntu 24.04, Debian 13, AlmaLinux and Rocky Linux 9

A process is a running program. To see what is running on a Linux server, and what uses the most CPU or memory, use ps for a snapshot, top or htop for a live view, and pgrep to find a program by name. We tested every command on Ubuntu 24.04, Debian 13 and AlmaLinux 9.

List all processes: ps

ps aux                     # every process, with user, CPU %, memory % and command
ps -ef                     # the same in another format, with the parent process ID (PPID)
ps aux --sort=-%mem | head # the processes using the most memory
ps aux --sort=-%cpu | head # the processes using the most CPU

Choose your own columns with -o, for example ps -eo pid,user,%cpu,%mem,etime,cmd --sort=-%cpu | head (etime is how long the process has been running).

Watch processes live: top and htop

top

In top, press M to sort by memory, P by CPU, k to kill a process and q to quit. htop is easier to read and lets you scroll and search:

sudo apt install htop      # Ubuntu, Debian
sudo dnf install htop      # AlmaLinux, Rocky Linux (from EPEL: sudo dnf install epel-release first)

Find a process by name

pgrep -a nginx             # process IDs and full commands
pidof sshd                 # just the process IDs
ps aux | grep '[n]ginx'    # the [n] trick hides the grep line itself

See processes as a tree

pstree -p                  # which process started which (package psmisc)
ps -ef --forest

Services

Most server software runs as a systemd service. Check it with systemctl status nginx, and list running services with systemctl list-units --type=service --state=running.

Stop a process

kill 1234                  # ask process 1234 to stop (SIGTERM)
kill -9 1234               # force it (SIGKILL) only if it does not stop
pkill -f "python app.py"   # by name or command line

For a service, use sudo systemctl restart name or stop instead of kill, so systemd knows about it.

Ucartz services for this topic

Was this answer helpful? 1 Users Found This Useful (3 Votes)