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. This is lesson 4 of 4. Any 3 lessons of this learning path are free to read in full — after that, CoddyKit PRO unlocks every lesson, plus hands-on practice with a built-in code editor and a 24/7 AI tutor. It is part of the DevOps Bootcamp learning path, and your progress syncs across the web and the CoddyKit app. The DevOps Bootcamp course includes 4 lessons in total.
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] 4821Listing 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.txtResuming 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 foregroundReferring to Jobs
Use %n to reference a job by number in commands like fg, bg, and kill.
kill %1 # terminate job number 1Jobs 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 %1Tools 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.
Learn DevOps Bootcamp with an AI tutor — free
Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.
- Courses
- 142
- Lessons
- 568
Frequently Asked Questions
Is the “Background Jobs & Job Control” lesson free?
Yes — any 3 lessons of the DevOps Bootcamp learning path, including “Background Jobs & Job Control”, are free to read in full here on the web. After that, CoddyKit PRO unlocks every lesson, plus interactive practice with a built-in code editor and a 24/7 AI tutor. The DevOps Bootcamp course includes 4 lessons in total.
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, so you can start here or from the beginning and move at your own pace. This is lesson 4 of 4.
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
- Managing Processes (ps, top, kill)
- Input/Output Redirection (>, >>, <)
- Piping Commands (|)
- Background Jobs & Job Control