Running Jobs in the Background
Concept & Overview
Imagine trying to copy a massive folder to a USB drive, but while it copies, you want to keep working and typing other commands in the same window. In Linux, we can run time-consuming tasks in the "background" so they don't lock up our command line.
- Adding an ampersand & to the end of a command (like sleep 100 &) tells the terminal to run it in the background and give you your prompt back immediately.
- The jobs command shows what is currently running in the background.
- The fg (foreground) command pulls a background task back to center stage.
sleep 100 & to start a background task, check it with jobs, and then pull it back to the foreground by running fg.Command Syntax Reference
| Command / Syntax | Description |
|---|---|
sleep 100 & | Run sleep in the background |
jobs | List background jobs |
fg | Bring background job to foreground |
Verification Objectives
These conditions will be automatically verified when you run commands inside the interactive terminal simulator:
- ○Run a sleep command in the background (&)
- ○Run the "jobs" command
- ○Bring the job back to foreground with "fg"
Ready to complete Quest 64?
Test your skills live in the browser terminal with an emulated Linux filesystem, real-time command evaluation, and instant step-by-step hints.