Processes and tasks

Command ps

Show list of processes

Linux · Bash examples · commands run on the selected server

When to use ps

Use ps for a snapshot of running processes, useful in noninteractive sessions and troubleshooting reports. Select useful columns and sort deliberately rather than assuming the default view includes every task.

Syntax

ps [PARAMETERS]

Square brackets mark optional arguments; an ellipsis means repetition. Replace example file names, user names and server addresses with your own values.

Common options and arguments

-e
Show all processes.
-f
Full output format.
-o FIELDS
Select columns and format.

Usage examples

View all processes

ps -ef

A broad process list includes ownership, IDs and command details.

Show your user's processes

ps -u "$USER" -o pid,ppid,stat,etime,cmd

The current user's processes are shown with selected status and elapsed-time fields.

Sort by memory in procps

ps aux --sort=-%mem | head -n 10

Processes are sorted by memory percentage and a short leading subset is displayed.

Notes and limitations

  • ps provides a snapshot of process state, not continuous monitoring.
  • procps supports several option styles. Check the documentation before mixing them.

Common questions and troubleshooting

Why does ps not continuously refresh?

It produces a snapshot. Use top or htop when you need a changing interactive view.

Can process command lines contain secrets?

Yes. Arguments can reveal tokens or passwords supplied by applications. Do not paste unreviewed process listings into public reports.

Further help

Options vary by version and distribution. Check the installed documentation with this command: man ps.