ps Show a snapshot of running processes
Lists the processes running on the machine at the moment you run it. You reach for it to find a process ID, check whether something is still running, or see what is using memory or CPU. Unlike top, it prints once and exits.
Synopsis
ps [OPTION]...
ps -p PID[,PID]... [-o KEYWORD[,KEYWORD]...]
Common options
| Option or form | What it does |
|---|---|
aux | BSD style, written without a dash. Shows every user's processes (a), with the owner (u), including ones with no terminal (x). The usual "show me everything" command on macOS |
-ef | POSIX style. -e selects every process and -f gives a full listing with parent PID and start time. Works on macOS and Linux |
-p PID | Show only the process or comma-separated processes with these IDs |
-u USER | Show processes belonging to the named user. On macOS this takes user names, not numeric IDs |
-o KEYWORD | Choose the columns, for example -o pid,ppid,%cpu,%mem,comm. Add =TEXT to a keyword to rename its header, or leave the text empty to hide it |
-r | Sort by current CPU use, highest first (macOS and BSD) |
-m | Sort by memory use, highest first (macOS and BSD) |
-A | Show every process, including other users' and those with no terminal. -e does the same |
Examples
ps
ps -p $$ -o pid,comm
ps aux | head -5
ps -ef | head -5
ps aux | grep '[n]ginx'
ps -A -m -o pid,%mem,comm | head -11
Notes
- ps has two option styles. BSD style has no leading dash (ps aux). POSIX style has one (ps -ef). They are not interchangeable: ps aux and ps -aux can mean different things, so type them as shown.
- Plain ps shows only your processes that are attached to the current terminal. Use aux or -ef to see everything.
- In ps aux | grep name, the grep process often matches itself. Writing the pattern as '[n]ame' stops that.
- The sort options -r and -m are BSD and macOS options. GNU ps on Linux uses --sort=-%cpu or --sort=-%mem instead, and GNU ps has different meanings for some other flags.
- ps shows one moment in time. For a live view that keeps updating, use top.
See also
Last reviewed 2026-10-07.