World map

 

BM: Baca dalam Bahasa Melayu

World L2: Keys & Staff

Signals, kill and jobs

You will learn: to stop a program politely or firmly, and to run long jobs in the background.

Checked with Linux (Debian 13) on 1 Nov 2026

The problem

The oven timer script is stuck in a loop. It runs outside your terminal, so Ctrl+C cannot reach it. How do you stop it?

Pick one answer.

Watch

You are you in /home/you. 1 things here. Services: cron running, ssh running, nginx running.

You are hereyou@kedai:~$

Folder ~

  • bin/ (folder)drwxrwxr-xoven-timer.sh

+ 3 hidden (ls -a)

Services

  • cronrunningstarts at boot
  • sshrunningstarts at boot
  • nginxrunningstarts at boot

Busy programs

  • 1241bash /home/you/bin/oven-timer.shusing the CPU

pkill sent a signal: A message to a process: TERM asks it to stop, KILL (9) stops it at once, Ctrl+C sends INT. called TERM: “please stop”. This script ignores it, so pgrep still finds PID 1241. Watch the busy list.

Check

Stopping a program is a ladder: polite first, firm last. Put the steps in order.

First step at the top. Put these in order. Use the arrows, or drag.

  • Ctrl+C, if it holds your terminal
  • Wait a few seconds, then check with pgrep
  • kill PID: the polite TERM signal
  • kill -9 PID: KILL, the last resort

Try it

The polite way failed. Use the last resort: kill -9. Stop the oven timer for good.

You are you in /home/you. 1 things here. Services: cron running, ssh running, nginx running.

You are hereyou@kedai:~$

Folder ~

  • bin/ (folder)drwxrwxr-xoven-timer.sh

+ 3 hidden (ls -a)

Services

  • cronrunningstarts at boot
  • sshrunningstarts at boot
  • nginxrunningstarts at boot

Busy programs

  • 1241bash /home/you/bin/oven-timer.shusing the CPU

Predict

Why not always start with kill -9?

Pick one answer.

Try it

A long job need not block you. Start one in the background with &: sleep 300 &. Then type jobs.

You are you in /home/you. 0 things here. Services: cron running, ssh running, nginx running.

You are hereyou@kedai:~$

Folder ~

Empty folder

+ 3 hidden (ls -a)

Services

  • cronrunningstarts at boot
  • sshrunningstarts at boot
  • nginxrunningstarts at boot

Check

Does the program hold your terminal (front), or let you type (back)?

Drag a card into a box. Or tap the card, then tap the box.

      You did it!

      You can now stop programs politely or firmly, and juggle jobs.

      Go deeper (optional)

      Signals have numbers. 15 is TERM, kill’s default. 9 is KILL. Ctrl+C sends 2, INT. kill %1 stops job 1. Work that must run all day belongs in a service: lesson 8.

      Real rep (optional), on your own Linux:

      Real mission

      1. sleep 100
      2. bg
      3. jobs
      4. kill %1

      0 of 5 steps done · Your ticks are saved.