M20 - Process Management: CLI
Process Management: CLI
List, filter, and stop processes from the command line with a stronger habit of inspecting before terminating.
- List processes from the CLI.
- Filter down to the process you care about.
- Stop a process more deliberately by PID or name when appropriate.
Why This Matters
The CLI becomes essential when:
- you are on a remote system with no GUI
- many similar processes are running
- you need a precise command you can repeat
But precision matters. The wrong kill command pointed at the wrong PID can stop the wrong work.
1. List Processes
Start by seeing what is running.
Get-Process
ps aux
This gives you the big picture, but usually too much detail for one task.
2. Narrow the Target
The next step is to filter down to the process you actually care about.
Get-Process | Where-Object { $_.ProcessName -like ‘code’ }
Get-Process -Name notepad
ps aux | grep ssh
ps -ef | grep python
The goal is to confirm identity first, not to jump straight to termination.
3. Stop Only When You Mean It
Once you are confident about the target, you can stop it.
Stop-Process -Id 1234
or by name when appropriate
Stop-Process -Name notepad
kill 1234
stronger signal only if the normal one does not work
kill -9 1234
Escalation Rule
Use gentler termination first when possible. Reserve stronger force for cases where inspection tells you the process is truly stuck and a normal stop is not working.
A Better Process Habit
Use this sequence:
- list processes
- narrow the target
- verify name or PID
- stop only if needed
- confirm the result afterward
That sequence is more important than memorizing lots of commands.
What to Ignore for Now
- signals beyond the basic idea
- per-thread process debugging
- daemon supervision internals
The important thing is learning precise inspection and cautious control.
Before You Move On
You are ready when you can:
- list processes on your platform
- narrow down to a target process
- explain why finding the exact PID reduces mistakes
Next, we look at foreground and background jobs so process control feels even more practical.