0
0
Linux CLIscripting~5 mins

fg and bg commands in Linux CLI - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the fg command do in Linux?
The fg command brings a background job to the foreground, letting you interact with it directly.
Click to reveal answer
beginner
What is the purpose of the bg command?
The bg command resumes a stopped job in the background, allowing it to keep running without blocking the terminal.
Click to reveal answer
beginner
How do you list all current jobs in the shell?
Use the jobs command to see all running or stopped jobs with their job numbers.
Click to reveal answer
intermediate
How do you bring a specific job to the foreground using fg?
Use fg %job_number, for example fg %1 to bring job number 1 to the foreground.
Click to reveal answer
beginner
What happens if you press Ctrl+Z while a command is running?
Pressing Ctrl+Z stops (pauses) the running command and puts it in the background as a stopped job.
Click to reveal answer
Which command resumes a stopped job in the background?
Ajobs
Bfg
Ckill
Dbg
What does fg %2 do?
ALists job number 2
BStops job number 2
CBrings job number 2 to the foreground
DRuns job number 2 in the background
How do you see all current jobs in the shell?
Ajobs
Bps
Cfg
Dbg
What key combination stops a running job and puts it in the background?
ACtrl+Z
BCtrl+C
CCtrl+D
DCtrl+S
If you want to interact with a background job, which command should you use?
Ajobs
Bfg
Cbg
Dkill
Explain how to pause a running command and then resume it in the background.
Think about keyboard shortcuts and job control commands.
You got /3 concepts.
    Describe the difference between fg and bg commands.
    Consider how you want to use the job after resuming it.
    You got /4 concepts.