Linux AdministrationMediumSingle Choice
Linux Administration Question
Statement
Which shell command is used to continue background execution of a suspended command?
#bg#job-control#sigtstp#sigcont#suspended-job
A
&
B
bg
Correct
C
cont
D
exec
E
:&
Resolution & Explanations
The bg command is used to resume a suspended job and run it in the background. When a command is suspended (e.g., by pressing Ctrl+Z), it is stopped and placed into a suspended state. The bg command takes that suspended job and continues its execution in the background, allowing the shell to accept new commands immediately.
How it Works
- Suspending a job: Pressing Ctrl+Z sends SIGTSTP to the foreground process, stopping it. The shell then reports the job number and its state (suspended).
- Using
bg: Typingbg(optionally with a job ID like%1) resumes the job in the background. The shell sends SIGCONT to the process group, and the job continues running but does not have control of the terminal. - The
&operator is used to start a command directly in the background, not to resume a suspended one. contis not a standard shell command; it is a misspelling ofcontinuein some contexts but not for job control.execreplaces the current shell with a new command; it does not resume background jobs.:&is not a valid shell command;:is a null command, and appending&would attempt to run it in the background, but it does not resume a suspended job.