0Pricing
DevOps Bootcamp · Lesson

Background Jobs & Job Control

Run commands without tying up your terminal. Learn background jobs, job control with jobs/fg/bg, and keeping processes alive after logout with nohup.

Background Jobs & Job Control is a free DevOps Bootcamp lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the DevOps Bootcamp learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Why Background Jobs?

Some commands run a long time. Instead of blocking your terminal, you can push them to the background and keep working in the same shell.

Starting in the Background

Append & to a command to launch it in the background. The shell prints a job number and a PID, then returns the prompt immediately.

sleep 300 &
[1] 4821

Listing Jobs

The jobs command lists background and stopped jobs for the current shell, each with a job number in brackets.

jobs
[1]+  Running   sleep 300 &

Suspending a Job

Press Ctrl+Z to suspend the foreground command. It stops (does not quit) and returns the prompt.

^Z
[1]+  Stopped   nano notes.txt

Resuming in the Background

bg resumes the most recent stopped job in the background so it keeps running while you work.

bg
[1]+ nano notes.txt &

Bringing to the Foreground

fg pulls a background or stopped job back to the foreground. Target a specific one with fg %n.

fg %1   # bring job 1 to the foreground

Referring to Jobs

Use %n to reference a job by number in commands like fg, bg, and kill.

kill %1   # terminate job number 1

Jobs vs PIDs

Job numbers are shell-local conveniences; PIDs are system-wide. Use job numbers within your shell, but PIDs with system tools like kill from another terminal.

Surviving Logout with nohup

Normally background jobs die when you log out. nohup detaches a command from the terminal so it keeps running after you leave.

nohup ./long_task.sh > out.log 2>&1 &

Disowning a Job

disown removes a running job from the shell job table, so closing the shell will not send it a hangup signal.

./task &
disown %1

Tools like screen and tmux

For serious long-running or remote sessions, terminal multiplexers like tmux or screen keep whole sessions alive and reattachable after disconnect.

Quick Check

Test your understanding.

Recap

You learned job control: launch with &, list with jobs, suspend with Ctrl+Z, move with bg/fg and %n, and keep tasks alive after logout with nohup, disown, or tmux/screen.

Frequently asked questions

Is the “Background Jobs & Job Control” lesson free?

Yes — the full text of “Background Jobs & Job Control” is free to read here on the web, and the DevOps Bootcamp course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the DevOps Bootcamp course, upgrade to CoddyKit PRO.

What will I learn in “Background Jobs & Job Control”?

Run commands without tying up your terminal. Learn background jobs, job control with jobs/fg/bg, and keeping processes alive after logout with nohup. You practise DevOps Bootcamp with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start DevOps Bootcamp?

No prior experience is required. DevOps Bootcamp on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Background Jobs & Job Control” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this DevOps Bootcamp lesson?

Yes. Every DevOps Bootcamp lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Managing Processes (ps, top, kill)
  2. Input/Output Redirection (>, >>, <)
  3. Piping Commands (|)
  4. Background Jobs & Job Control
← Back to DevOps Bootcamp