LAB-PROC-03 - Signals and Controlled Stopping

Understand basic process signals and practice stopping harmless processes with a preference for gentler signals first.

PS Process Management

Signals and Controlled Stopping

Understand basic process signals and practice stopping harmless processes with a preference for gentler signals first.

35 min INTERMEDIATE LINUX
What success looks like
  • Understand basic process signals and practice stopping harmless processes with a preference for gentler signals first.
  • Repeat the workflow without copy-paste or step-by-step prompting.
Safety notes
  • Double-check process IDs and commands before stopping anything outside the lab scenario.

Part A: The Field Guide

The kill command sends a signal. It does not magically mean "destroy this process" every time.

For this lab, the most important signals are:

  • SIGTERM for a normal stop request
  • SIGKILL for force when normal stopping fails
  • SIGINT as the signal behind Ctrl+C

Good Default

Try a normal stop first. Force is a later step, not the first habit.


Part B: The Drill Deck

Terminal required: create only harmless targets and stop only those.

G
Guided Step by step - type exactly this and compare the result
>

Exercise G1: Create a harmless target

  1. Run sleep 300 &
  2. Run pgrep sleep
  3. Note the PID

Exercise G2: Send a normal stop request

  1. Run kill <PID>
  2. Wait a moment
  3. Run pgrep sleep
  4. Confirm the process is gone

Exercise G3: Use Ctrl+C on a foreground process

  1. Run ping localhost
  2. Let it run briefly
  3. Press Ctrl+C
  4. Explain how that differs from killing a background process by PID
S
Solo Task described, hints available - figure it out
>

Exercise S1: Compare term versus kill

Create another harmless sleep process and answer in words:

  1. what a polite stop is trying to allow
  2. why a forced stop is more abrupt
  3. why you would avoid the forced route unless needed

Exercise S2: Optional name-based stop

  1. create two harmless sleep processes
  2. verify them with pgrep sleep
  3. stop them with pkill sleep or killall sleep
  4. confirm they are gone
M
Mission Real scenario - no hints, combine multiple skills
>

Mission M1: Build a safe stop sequence

Describe the sequence you would follow before stopping a process on a real machine:

  1. identify the exact process
  2. verify the PID or name
  3. decide whether a normal stop is appropriate
  4. confirm the result afterward

If that sequence is clear in your head, you are building the right operational habit.

What to do next

Best next step Learning

Return to the related lesson if you want the concept explained more deeply.

Open now