Intermediate · 8 min · practise every command in the built-in terminal

ps — Process Status

ps shows running processes.

Common usage

ps                     # Your processes in current shell
ps aux                 # ALL processes, detailed
ps -ef                 # All processes, full format
ps -u student          # Processes for user 'student'

ps aux output explained

USER  PID  %CPU %MEM  VSZ   RSS  TTY  STAT  START  TIME  COMMAND
root    1   0.0  0.1  168M  10M  ?    Ss   10:00  0:01  /sbin/init
ColumnMeaning
USEROwner
PIDProcess ID
%CPUCPU usage
%MEMMemory usage
VSZVirtual memory
RSSPhysical memory
STATProcess state
STARTStart time
COMMANDCommand name

Process states (STAT)

StateMeaning
RRunning
SSleeping
DUninterruptible sleep
ZZombie
TStopped

Finding processes

ps aux | grep nginx
ps aux | grep -v grep | grep python
pgrep nginx                           # Just the PIDs

Process tree

ps -ejH                # Hierarchical
pstree                 # Visual tree

Practice tasks

  1. List all running processes
  2. Find the process ID of bash
  3. Show all processes in full format
  4. Search processes for bash while excluding the grep line itself

Commands in this lesson

Processes