0
0
Linux CLIscripting~10 mins

ps (list processes) in Linux CLI - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - ps (list processes)
Run 'ps' command
System collects process info
Display process list
User reads output or pipes it
The 'ps' command asks the system to gather current process details and then shows them as a list.
Execution Sample
Linux CLI
ps
This command lists the current processes running in the terminal session.
Execution Table
StepActionSystem ResponseOutput Example
1User types 'ps' and presses EnterShell runs 'ps' command
2'ps' collects process info for current terminal sessionSystem gathers PID, TTY, TIME, CMD
3'ps' formats and prints the process listOutput shows columns PID, TTY, TIME, CMD PID TTY TIME CMD 1234 pts/0 00:00:00 bash 5678 pts/0 00:00:00 ps
4User reads the list or pipes it for further useProcess list is ready for viewing or scripting
5No more processes to list, command endsShell prompt returns
💡 'ps' finishes after listing current processes and returns control to the shell
Variable Tracker
VariableStartAfter Step 2After Step 3Final
Process Listemptycollected current session processesformatted for displaydisplayed to user
Outputnonenoneprocess info linesprinted on screen
Key Moments - 3 Insights
Why does 'ps' only show processes related to my terminal by default?
By default, 'ps' shows processes attached to your current terminal (TTY). This is why the output is limited, as seen in execution_table step 2 where it collects only current session processes.
What do the columns PID, TTY, TIME, and CMD mean in the output?
PID is the process ID number, TTY is the terminal associated, TIME is CPU time used, and CMD is the command name. This is shown in execution_table step 3 output example.
How can I see all processes, not just mine?
You can use options like 'ps aux' to list all processes. The basic 'ps' command shown here only lists your session's processes, as explained in the concept_flow.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what does 'ps' do at step 2?
ACollects process info for current terminal session
BPrints the process list on screen
CEnds the command and returns to shell
DWaits for user input
💡 Hint
Check the 'System Response' column in step 2 of execution_table
At which step does 'ps' display the process list?
AStep 2
BStep 3
CStep 1
DStep 5
💡 Hint
Look at the 'Output Example' column in execution_table
If you want to see all processes, not just your terminal's, what should you do?
AUse 'ps' with no options
BRestart the terminal
CUse 'ps aux' or similar options
DUse 'ps' and then press Enter twice
💡 Hint
Refer to key_moments where it explains how to see all processes
Concept Snapshot
ps command lists processes running in your terminal session
Syntax: ps
Shows columns: PID (process ID), TTY (terminal), TIME (CPU time), CMD (command)
Default shows only your session's processes
Use options like 'ps aux' to see all processes
Full Transcript
The 'ps' command is used to list processes running in your current terminal session. When you type 'ps' and press Enter, the system collects information about processes related to your terminal, including their process ID (PID), terminal (TTY), CPU time used (TIME), and the command name (CMD). This information is then displayed as a list. By default, 'ps' only shows processes attached to your terminal. To see all processes on the system, you can use options like 'ps aux'. The command finishes after printing the list and returns control to the shell prompt.