M20 - Process Management: CLI

List, filter, and stop processes from the command line with a stronger habit of inspecting before terminating.

Processes

Process Management: CLI

List, filter, and stop processes from the command line with a stronger habit of inspecting before terminating.

40 min INTERMEDIATE BOTH Field-verified
What you should learn
  • List, filter, and stop processes from the command line with a stronger habit of inspecting before terminating.
Visual model

Concept to practice path

Each lesson is meant to move from an idea, to an example, to a safe practice step.

Open the full visual

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.

Safety sequence

CLI process safety order

  1. List processes before you act.
  2. Filter to the exact target and confirm the name or PID.
  3. Use a normal stop first when possible.
  4. Verify that only the intended process changed state.

1. List Processes

Start by seeing what is running.

List Processes in PowerShell

Get-Process

List Processes in Linux

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.

Filter Processes in PowerShell

Get-Process | Where-Object { $_.ProcessName -like 'code' }

Get-Process -Name notepad

Filter Processes in Linux

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 a Process in PowerShell

Stop-Process -Id 1234

or by name when appropriate

Stop-Process -Name notepad

Stop a Process in Linux

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:

  1. list processes
  2. narrow the target
  3. verify name or PID
  4. stop only if needed
  5. 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:

  1. list processes on your platform
  2. narrow down to a target process
  3. explain why finding the exact PID reduces mistakes

Next, we look at foreground and background jobs so process control feels even more practical.

Learning loop

Recall it, check it, then practice it.

Do this before moving on. It turns reading into memory and safer action.

Recall
  • Why is it worth finding the exact PID before stopping a process?
  • What should you inspect before deciding to terminate something from the CLI?
Check
  • List processes and isolate one target process without notes.
  • Explain the difference between inspecting a process and stopping it.

What to do next

Best next step Practice

Use the matching lab or keep building skill in practice.

Open now