0
0
Linux CLIscripting~10 mins

Background processes (&) in Linux CLI - Mini Project: Build & Apply

Choose your learning style9 modes available
Using Background Processes with & in Linux CLI
📖 Scenario: You are working on a Linux system and want to run commands without waiting for them to finish. This helps you do other tasks while the command runs in the background.
🎯 Goal: Learn how to run a command as a background process using the & symbol in the Linux command line.
📋 What You'll Learn
Create a simple command that runs for a few seconds
Add a background process indicator variable
Run the command in the background using &
Display a message showing the command is running in the background
💡 Why This Matters
🌍 Real World
Running long tasks like downloads or scripts in the background lets you keep using the terminal for other work.
💼 Career
System administrators and developers often use background processes to manage multiple tasks efficiently on servers and development machines.
Progress0 / 4 steps
1
Create a command that runs for 5 seconds
Type the command sleep 5 which pauses the terminal for 5 seconds.
Linux CLI
Need a hint?

The sleep command pauses the terminal for the number of seconds you specify.

2
Create a variable called background with the value &
Create a variable called background and set it to the string &.
Linux CLI
Need a hint?

Use background='&' to store the background process symbol.

3
Run the sleep 5 command in the background using &
Run the command sleep 5 followed by & to run it in the background.
Linux CLI
Need a hint?

Use sleep 5 & to run the command in the background.

4
Print a message showing the command is running in the background
Use echo to print the message "The sleep command is running in the background".
Linux CLI
Need a hint?

Use echo "The sleep command is running in the background" to show the message.