4. You ran sleep 300 & and then jobs shows the job as stopped. Which command will resume the job in the background?
medium
A. kill %1
B. bg %1
C. fg %1
D. stop %1
Solution
Step 1: Understand job states and commands
A stopped job is paused. The bg command resumes it in the background, while fg resumes it in the foreground.
Step 2: Choose correct command for background resume
Since the question asks to resume in background, bg %1 is correct. kill terminates, and stop is invalid here.
Final Answer:
bg %1 -> Option B
Quick Check:
Resume stopped job in background = bg %job_number [OK]
Hint: Use bg %job_number to resume stopped jobs in background [OK]
Common Mistakes:
Using fg instead of bg for background resume
Trying to kill instead of resume
Using invalid stop command
5. You have multiple background jobs running. You want to bring job number 3 to the foreground and then stop it temporarily. Which sequence of commands should you use?
hard
A. fg %3, then press Ctrl+Z
B. bg %3, then press Ctrl+C
C. kill %3, then fg %3
D. jobs %3, then stop %3
Solution
Step 1: Bring job 3 to foreground
Use fg %3 to bring job number 3 to the foreground so you can interact with it.
Step 2: Stop the job temporarily
Pressing Ctrl+Z sends a stop signal, pausing the job and returning control to the shell.
Final Answer:
fg %3, then press Ctrl+Z -> Option A
Quick Check:
Foreground job then Ctrl+Z to stop it [OK]
Hint: Use fg %job then Ctrl+Z to pause foreground job [OK]
Common Mistakes:
Using bg instead of fg to bring job forward
Trying to kill instead of stop
Using invalid stop command
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.