LAB-PROC-03 - Signals and Controlled Stopping
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 Curriculum-reviewed
Prerequisites
Success criteria
- Use kill with a harmless target process.
- Explain why SIGTERM should usually come before SIGKILL.
Safety notes
- Only target harmless lab processes you created yourself.
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:
SIGTERMfor a normal stop requestSIGKILLfor force when normal stopping failsSIGINTas the signal behindCtrl+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
- Run
sleep 300 & - Run
pgrep sleep - Note the PID
Exercise G2: Send a normal stop request
- Run
kill <PID> - Wait a moment
- Run
pgrep sleep - Confirm the process is gone
Exercise G3: Use Ctrl+C on a foreground process
- Run
ping localhost - Let it run briefly
- Press
Ctrl+C - 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:
- what a polite stop is trying to allow
- why a forced stop is more abrupt
- why you would avoid the forced route unless needed
Exercise S2: Optional name-based stop
- create two harmless
sleepprocesses - verify them with
pgrep sleep - stop them with
pkill sleeporkillall sleep - 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:
- identify the exact process
- verify the PID or name
- decide whether a normal stop is appropriate
- confirm the result afterward
If that sequence is clear in your head, you are building the right operational habit.