Skip to Content
Navigation:

A stick figure smiling

This is a page from an upcoming zine called "The Secret Rules of the Terminal".

To get an email when the zine comes out, sign up for the zine announcements list!

Image of a comic. To read the full HTML alt text, click "read the transcript".
read the transcript!

your shell lets you run many programs (“jobs”) in the same terminal tab

programs can either be:

  • foreground
  • background
  • stopped (which is more like “paused”)

& runs a program in the background

for example I like to convert 100 files in parallel like this:

for i in `seq 1 100`
do
   convert $i.png $i.jpg &
done

jobs lists backgrounded & stopped jobs

$ jobs
[1] Running python blah.py &
[2] Stopped vim

use the numbers to bring them to the foreground or background (like fg %2), kill them (kill %2), or disown them

when you close a terminal tab all jobs are killed with a SIGHUP signal

you can stop this with disown or by starting the program with nohup: disown %1 (job number goes here) nohup my_program &

a trick to kill programs if Ctrl+C doesn’t work

  1. press Ctrl+Z to stop the program
  2. run kill %1 to kill it (or kill -9 %1 if you’re feeling extra murderous)

a little flowchart

Three boxes, labelled “running in foreground”, “stopped”, and “running in background”

Ctrl+Z goes from “running in foreground” to “stopped” fg goes from “stopped” to “running in foreground” fg goes from “running in background” to “running in foreground” bg goes from “stopped” to “running in background”

Saturday Morning Comics!

Want another comic like this in your email every Saturday? Sign up here!

I'll send you one of my favourite comics from my archives every Saturday.
© Julia Evans 2025 | All rights reserved (see the FAQ for notes about licensing)