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.
ps
| Step | Action | System Response | Output Example |
|---|---|---|---|
| 1 | User types 'ps' and presses Enter | Shell runs 'ps' command | |
| 2 | 'ps' collects process info for current terminal session | System gathers PID, TTY, TIME, CMD | |
| 3 | 'ps' formats and prints the process list | Output shows columns PID, TTY, TIME, CMD | PID TTY TIME CMD 1234 pts/0 00:00:00 bash 5678 pts/0 00:00:00 ps |
| 4 | User reads the list or pipes it for further use | Process list is ready for viewing or scripting | |
| 5 | No more processes to list, command ends | Shell prompt returns |
| Variable | Start | After Step 2 | After Step 3 | Final |
|---|---|---|---|---|
| Process List | empty | collected current session processes | formatted for display | displayed to user |
| Output | none | none | process info lines | printed on screen |
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
ps command do in Linux?psps command is used to show processes running on the system.ps shows running processes [OK]ps?-ef option with ps lists all processes with full details.ps -ef shows all processes fully [OK]ps -ef for full process list [OK]ps -xv which is invalidps auxf as a single optionps -l which shows limited infops -e | grep sshd if the sshd process is running?ps -e and pipe to grepps -e lists all processes; piping to grep sshd filters lines containing 'sshd'.ps -e | grep sshd shows sshd if running [OK]ps -ef | grep but get an error. What is the likely cause?ps -ef outputs all processes; piping to grep requires a pattern to search.grep throws an error because it expects a search term.ps -u alice lists processes for user alice; -f adds full details.ps -u alice -f lists alice's processes fully [OK]ps -u username -f for detailed user processes [OK]Pass the test and this pattern moves unknown