Bash Process Status
ps prints a snapshot of currently running processes, and its aux flags reveal everything happening on the system at once.
What ps Shows
Run on its own, ps lists the processes running in your current terminal session: a process ID (PID), the terminal it's attached to (TTY), how much CPU time it has consumed (TIME), and the command that launched it (CMD).
Basic ps
$ ps
PID TTY TIME CMD
2041 pts/0 00:00:00 bash
2117 pts/0 00:00:00 psps aux: The Full Picture
The aux flags expand the view dramatically: a shows processes from every user, u switches to a user-oriented format with CPU and memory percentages, and x includes processes without a controlling terminal, like background daemons. Combined, ps aux lists essentially every process on the machine.
ps aux
$ ps aux | head -n 5
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.1 168944 11220 ? Ss 08:01 0:02 /sbin/init
root 412 0.0 0.0 22528 3120 ? Ss 08:01 0:00 /usr/sbin/cron
alice 3305 0.1 0.4 812340 65200 ? Sl 08:03 0:11 node server.js
alice 4021 0.0 0.0 9032 980 pts/0 R+ 09:14 0:00 ps auxFiltering with ps
Because ps aux prints one line per process, it pairs naturally with grep to find a specific program. The grep command itself always shows up as a match too, since it is briefly a running process at the moment the pipeline executes.
Finding a Process by Name
$ ps aux | grep nginx
root 1188 0.0 0.2 55344 9100 ? Ss 08:01 0:00 nginx: master process
www-data 1189 0.0 0.1 55700 6200 ? S 08:01 0:00 nginx: worker process
alice 4030 0.0 0.0 9032 984 pts/0 S+ 09:16 0:00 grep nginx- PID — the unique process ID used to reference the process in other commands
- PPID — the parent process ID (visible with ps -ef) showing what launched it
- STAT — process state codes such as R (running), S (sleeping), Z (zombie), and T (stopped)
- %CPU / %MEM — current share of processor time and memory in use
- TIME — total CPU time consumed since the process started, not wall-clock time