How to Monitor Processes with ps and top

Published 2026-08-05 · Learn Linux

To see what is running on your Linux machine, use ps for a snapshot or top for a live view. ps aux lists every process with its CPU and memory usage, and top refreshes that list every few seconds.

List every process with ps aux

The classic ps aux shows all users' processes with columns for PID, CPU, memory, start time and the command. Pipe it into grep to find a specific program.

$ ps aux
$ ps aux | grep nginx

Find a process by name

If grep gives you too much output, use pgrep to print only the matching PIDs. The PID is what you pass to kill.

$ pgrep -a nginx

Watch processes live with top

The top command shows the busiest processes at the top and updates continuously. Press q to quit. Inside top, press M to sort by memory use and P to sort by CPU.

$ top

Show a tree of parent processes

Use ps -ef --forest to draw the parent-child tree, so you can see which process spawned which. This is invaluable when a service launches several helpers.

$ ps -ef --forest

Sort by memory or CPU

For a clean one-shot ranking, sort with --sort. Descending memory use: ps aux --sort=-%mem. Then investigate the top hogs or stop them with kill.

$ ps aux --sort=-%mem
$ ps aux --sort=-%cpu

For a richer live dashboard many admins prefer htop. The ps and top reference pages list all options.

Keep learning

Related guides: How to Kill a Process in Linux with the kill Command · How to Check Disk Usage with df and du · How to Check Open Ports with ss and netstat. Read all tutorials on the Learn Linux blog.