Learn Understand first, then practice while the concept is still fresh.

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 Curriculum-reviewed
What you should be able to do after this
  • 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.

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.