Bird
0
0

Given the following commands run in a terminal:

medium📝 Command Output Q13 of 15
Linux CLI - Process Management
Given the following commands run in a terminal:
sleep 100 &
jobs
fg %1

What will happen after running fg %1?
AThe sleep command will continue running in the background
BAn error will occur because %1 is invalid
CThe sleep command will be terminated
DThe sleep command will be brought to the foreground and block the terminal
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the commands

    sleep 100 & runs sleep in background. jobs lists it as job 1. fg %1 brings job 1 to foreground.
  2. Step 2: Understand effect of fg

    Bringing sleep to foreground means it blocks terminal until it finishes or is stopped.
  3. Final Answer:

    The sleep command will be brought to the foreground and block the terminal -> Option D
  4. Quick Check:

    fg %1 = foreground job blocks terminal [OK]
Quick Trick: fg brings job to foreground and blocks terminal [OK]
Common Mistakes:
  • Thinking fg keeps job in background
  • Assuming fg terminates job
  • Believing %1 is invalid without jobs output

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes