builtin

bg

Resume stopped jobs in the background. In a fresh terminal run sleep 10, press Ctrl-Z promptly, inspect jobs, then resume the actual stopped job and let it finish. Terminal execution is not locally tested.

Formal Syntax & Structure

bash syntaxbash
bg [jobspec ...]

Parameters & Attributes

NameTypeDescription
jobspecjob identifierActual job in this shell.

Return Value

exit status

fg returns the foreground command status or a failure; bg returns zero on successful resumption, nonzero on error.

Working Example

Example Snippetbash
# After stopping your own sleep job with Ctrl-Z, inspect jobs.jobs# If that job is 1:bg %1wait %1
Bash Reference