Skip to main content

Process Management and Job Control

SUPPORTING CONCEPT - Extends shell mastery into long-running programs, signals, and control

Concept Cluster Navigation

Cluster 01: Shell Mastery

What This Concept Is

A process is a running program. The shell does not just launch commands; it also gives you ways to inspect running work, suspend it, resume it, background it, or terminate it with the right signal.

Why It Matters Here

Development work is full of long-running processes: test watchers, local servers, compilers, package installs, data scripts, SSH sessions, and tunnels. If you cannot manage processes, the terminal feels fragile.

Concrete Example

You start a development server:

python -m http.server 8000

Then you realize you still need the same shell for other work.

Professional response:

  1. Press Ctrl+Z to suspend the job
  2. Run bg to continue it in the background
  3. Use jobs to confirm it is still running
  4. If needed later, use fg to bring it back

If a process is genuinely stuck:

ps aux | grep python
kill -15 <pid>

Start graceful. Escalate only if necessary.

Common Confusion / Misconception

These actions are not the same:

  • Ctrl+C interrupts the foreground process
  • Ctrl+Z suspends it
  • bg resumes a suspended job in the background
  • fg returns a job to the foreground
  • kill -15 asks a process to terminate cleanly
  • kill -9 force-kills it without cleanup

How To Use It

Useful commands:

ps
ps aux
top
jobs
bg
fg
kill -15 <pid>
kill -9 <pid>

Job control applies to jobs launched from your current shell. ps applies more broadly to processes on the system.

Check Yourself

  1. When would you use Ctrl+Z instead of Ctrl+C?
  2. Why should kill -9 not be your first move?
  3. What is the difference between a shell job and a system process?

Mini Drill or Application

Run this drill:

  1. Start python -m http.server 8000
  2. Suspend it with Ctrl+Z
  3. Resume it with bg
  4. Confirm it with jobs
  5. Find it with ps
  6. Terminate it with kill -15

Then repeat the drill without notes.

Read this only if stuck

  • Start with Reference and Selective Reading for the curated shell, editor, and environment sources.
  • If you need a second explanation, skim Missing Semester and then retry the commands from this page.
  • Prefer one concrete terminal action over more passive reading.

Video and Lecture References

Depth Path

Professional Integration

Professional engineers constantly manage running systems. Local servers, tunnel sessions, database containers, and test runners all require the ability to inspect and control processes without panic.

Cluster Integration Check

  • You can suspend and resume a foreground job
  • You can identify a process with ps
  • You know when to use graceful versus forced termination
  • You can explain job control without mixing it up with file navigation

Ready to advance: Continue to Command Composition, Redirection, and Pipes.