ps

>Usage

The ps command in Unix is used to display information about active processes. It provides details on running processes, including process ID (PID), memory usage, CPU usage, and more, useful for monitoring system performance and managing running tasks.

>Synopsis

ps [-aux | -ef | -u | -e | -f ...]

>Options

aux

Shows detailed information about all processes, including memory and CPU usage for each user.

Example:

Dots

-zsh

> ps aux


USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.1 22580 2284 ? Ss 13:21 0:00 /sbin/init
john 1032 1.2 1.0 159644 19320 ? Ssl 13:21 0:30 /usr/bin/python3 my_script.py

-ef

Displays every process in a hierarchical structure, useful for understanding parent-child relationships.

Example:

Dots

-zsh

> ps -ef


UID PID PPID C STIME TTY TIME CMD
root 1 0 0 13:21 ? 00:00:00 /sbin/init
john 1032 1 0 13:21 ? 00:00:30 /usr/bin/python3 my_script.py

-u [username]

Restricts the display to processes owned by a specific user.

Example:

Dots

-zsh

> ps -u john


PID TTY TIME CMD
1032 ? 00:00:30 /usr/bin/python3 my_script.py

-e

Displays all processes running on the system.

Example:

Dots

-zsh

> ps -e


PID TTY TIME CMD
1 ? 00:00:03 init
1032 ? 00:00:30 python3
2048 tty1 00:00:00 bash

-f

Displays a full-format listing, including UID, PID, PPID, C, STIME, and TTY.

Example:

Dots

-zsh

> ps -f


UID PID PPID C STIME TTY TIME CMD
root 1 0 0 13:21 ? 00:00:00 /sbin/init
john 1032 1 0 13:21 ? 00:00:30 /usr/bin/python3 my_script.py

>Quiz

Progress: Question ? out of 5

Question Title

Page written by Emily Pable