Interactive Bash job number 1 is stopped.
Resume it without moving it to the foreground.
Which command is correct?
bg resumes a stopped job in the background. It uses Bash's job specification rather than requiring a raw PID.
Detailed explanation
fg %1Incorrect. fg resumes the job in the foreground.
Incorrect. fg resumes the job in the foreground.
jobs %1Incorrect. jobs only reports the status.
Incorrect. jobs only reports the status.
wait %1Incorrect. wait waits for completion; it does not resume a stopped job.
Incorrect. wait waits for completion; it does not resume a stopped job.
bg %1Correct. bg %1 resumes job 1 while keeping it in the background.
Correct. bg %1 resumes job 1 while keeping it in the background.
Try it yourself
An example you can run in a temporary verification environment.
対話的BashでジョブをCtrl+Zにより停止後、bg %1 と jobs を実行して確認Expected result
ジョブ1がRunning状態として表示されるKey points
- bg resumes in the background
- A stopped job is the target
- Distinguish job specifications from PIDs
Notes
- Environment: 対話的Bash 5.2
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.