Using ps to list processes (introduction)

nas

The ps program can be used to take a snapshot of processes on your system. This post shows you some basic usage.

Reading time:
1 min

Overview

ps accepts several styles of options (UNIX, BSD, and GNU).

Unix options are preceeded by a hyphen, BSD options are not, while GNU options are preceeded by two hyphens. These different types of options can be mixed together, but some options combinations can be confused with others (for example -xyz may not be the same as xyz). See the man page for alternatives and a full list of options, meanwhile, here are some useful basics to get you going.

All processes

To see all processes on the system (along with the command line arguments used to start each process) you could use:

ps aux

Processes for user

To see all processes for a particular user (along with the command line arguments for each process) you could use:

ps U username u

Process tree

A process tree shows the child/parent relationships between processes. (When a process spawns another process, the spawned is called a child process while the other is the parent)

ps afjx

NB: The program pstree can also be used to display a process tree.

For a closer look at the ps command, read our advanced ps article.

Thank you for reading this article.
Please share if you liked it.