The ps Command
ps is like a class roll call that lists every program currently running, each with its own ID number, so you know who is up and about on your computer.
In this page:
Syntax
ps [options]
ps -p process_id
The ps Command
ps lists currently running processes, showing information like process ID (PID), status, and the command that started them. ps aux is a common invocation showing all processes for all users with detailed columns.
It's the primary tool for inspecting what's running on a system.
Note:
- Pipe
ps auxintogrepto find a specific process by name, e.g. ps aux | grep myscript.
Example: The ps Command
#!/bin/bash
echo "Current shell's PID: $$"
ps -p $$
Login to try C/C++/Java/PHP code in the editor
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the
view already swaps in the hi_ translation fields (or blanks these
out if untranslated), so this renders correctly for both languages
without a lang_code check here. #}
Common Mistakes
- Using
ps aux | grep nameand matching thegrepprocess itself. - Forgetting that
psoptions differ between systems. - Parsing the default
psoutput in scripts, whenps -o pid,commgives stable columns.
🔒
Chapter Quiz — Complete all 12 topics to unlock
0/12 topics done
Complete these topics first: