Skip to main content

ps Cheatsheet

By Dejan Panovski Updated on Download PDF

Quick reference for listing and filtering processes with ps in Linux

The `ps` command displays process information in Linux. This cheatsheet covers common output formats, filtering patterns, sorting, and practical process-inspection commands.

Basic Syntax

Core ps command forms.

CommandDescription
psShow processes in the current shell
ps -eShow all running processes
ps -fShow full-format output
ps auxBSD-style all-process listing with user and resource info
ps -efSysV-style all-process listing

List Processes

Common process listing commands.

CommandDescription
ps -eList all processes
ps -efFull process list with PPID and start time
ps auxDetailed list including CPU and memory usage
ps -u usernameProcesses owned by a specific user
ps -p 1234Show one process by PID

Select and Filter

Filter output to specific process groups.

CommandDescription
ps -C nginxMatch processes by command name
ps -p 1234,5678Show multiple PIDs
ps -u root -U rootShow processes by effective and real user
ps -t pts/0Show processes attached to a terminal
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpuCustom output sorted by CPU

Custom Output Columns

Show only the process fields you need.

CommandDescription
ps -eo pid,cmdPID and command
ps -eo user,pid,%cpu,%mem,cmdUser, PID, CPU, memory, command
ps -eo pid,lstart,cmdPID with full start time
ps -o pid= -o comm=Output without column headers
ps -p 1234 -o pid,ppid,user,%cpu,%mem,cmdCustom fields for one PID

Process Tree and Parent/Child

Inspect process hierarchy.

CommandDescription
ps -ejHHierarchical process view
ps -axjfForest view (BSD style)
ps -o pid,ppid,cmd -p 1234Parent-child context for one process
ps -eo pid,ppid,cmd --sort=ppidGroup processes by parent PID

Useful Patterns

Common real-world combinations.

CommandDescription
ps aux | grep nginxQuick process search (includes grep line)
ps -C nginx -o pid,cmdCleaner command-name search without grep
ps -eo pid,%cpu,%mem,cmd --sort=-%mem | headTop memory consumers
ps -eo pid,%cpu,cmd --sort=-%cpu | headTop CPU consumers
ps -ef | grep -v grep | grep sshdLegacy grep pipeline pattern

Troubleshooting

Quick checks for common ps usage issues.

IssueCheck
Command not visible in outputUse ps -ef or ps aux for full list
Process disappears between checksIt may be short-lived; sample repeatedly or use watch
grep shows itselfUse ps -C name or pgrep instead of raw grep
Missing expected process detailsAdd fields with -o (for example %cpu, %mem, lstart)
Need exact process ID for killUse ps -C name -o pid= or pgrep name

Use these guides for full process-management workflows.

GuideDescription
Ps Command in LinuxFull ps guide with examples
Kill Command in LinuxTerminate processes by PID
Pkill Command in LinuxKill processes by name/pattern
Pgrep Command in LinuxFind process IDs by name and pattern
How to Kill a Process in LinuxPractical process-stop workflow