Viewing processes: ps, pgrep, top
Updated November 1, 2026
A process is a running program with its own PID. You can look at processes with a few commands.
ps aux # every process on the system
ps -u student # just yours
pgrep -x sleep # PIDs of processes named exactly sleep
top # a live list, q to quitSample output
$ ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
student 1 0.0 0.0 4472 3276 ? Ss 03:48 0:00 bash demo.sh
student 7 0.0 0.0 2708 1708 ? S 03:48 0:00 sleep 300
student 8 0.0 0.0 2708 1712 ? S 03:48 0:00 sleep 200
student 10 0.0 0.0 8032 3872 ? R 03:48 0:00 ps aux
$ pgrep -a sleep
7 sleep 300
8 sleep 200ps gives a snapshot, top refreshes live, pgrep finds a PID by name to feed into kill.
Common mistakes
The %CPU column in ps is an average over the whole life of the process, not the load right now. A process that spun a loop for five seconds and then went to sleep still shows up in ps as 39.5 a few seconds later, while top prints 0.0 for it at that same moment. Ask top who is loading the machine now, not ps aux.
ps with no arguments shows only the processes of your own terminal: sh, bash, your sleep and ps itself - four lines with pts/0 in the TTY column. A daemon has no terminal, its TTY column holds ?, and the short ps never lists it. For the full list use ps aux or ps -e.
ps aux | grep sleep always returns one extra line, grep sleep: grep is a process too, and the word you searched for sits in its own command line. So the answer to "how many copies are running" is off by one. pgrep -a sleep counts honestly, but it has its own limit: the kernel stores a process name in 15 characters, and pgrep -x my-very-long-daemon-name replies pgrep: pattern that searches for process name longer than 15 characters will result in zero matches. Match long names against the full command line with pgrep -f.
Used in
You need this in the lessons Processes and jobs and Monitoring.