HxHippy

ps

Report a snapshot of current processes

Overview

Displays information about a selection of the active processes running on the system. It can show process IDs, user, CPU/memory usage, command name, etc.

Syntax

ps [OPTION]...

Common Options

a

(All with tty) List all processes with a TTY, except session leaders.

u

(User-oriented format) Display user-oriented format (USER, PID, %CPU, %MEM, VSZ, RSS, TTY, STAT, START, TIME, COMMAND).

x

(Processes without controlling ttys) List processes without a controlling TTY (often daemons).

e, -e, -A

(All processes) Select all processes on the system.

-f, --full

Do full-format listing. Often used with -e (e.g., ps -ef).

-l, l

(Long format) Display long format, providing more detail.

--forest

Display processes in a hierarchical "forest" or "tree" view, showing parent-child relationships.

aux

Common combination: a (all with tty), u (user-oriented), x (processes without controlling tty).

-C command_name

Select by command name.

-u userlist, --user userlist

Select by effective user ID (EUID) or name.

-p pidlist, --pid pidlist

Select by process ID (PID).

--sort specifiers

Specify sorting order (e.g., ps aux --sort=-%cpu to sort by CPU usage descending).

Examples

$ ps aux

Show all processes on the system in user-oriented format.

$ ps -ef

Show all processes in full format (another common way to see everything).

$ ps -u username

Show processes owned by username.

$ ps -p 12345

Show information for process ID 12345.

$ ps aux --sort=-%mem | head

Show processes sorted by memory usage (descending) and display the top few.

$ ps -ef --forest

Show all processes in a tree-like format.

$ ps -C nginx

Show processes named nginx.

processstatuslisttasksrunningpidpstask manager