bg(1)
Resume a suspended job in the background.
Synopsis
bg [%jobspec ...]Description
The bg command resumes execution of suspended jobs in the background. When a job is suspended (typically with Ctrl+Z), it stops running but remains associated with the terminal session. bg allows that job to continue running without blocking the shell prompt.
If no job specification is provided, bg resumes the most recently suspended job (the "current" job). Multiple jobs can be resumed with a single command by specifying their job numbers.
Common options
| Flag | What it does |
|---|---|
%N | Resume job number N (e.g., bg %1 for job 1) |
%string | Resume job whose command name begins with string |
%% | Resume the current job (same as bg with no arguments) |
%+ | Resume the current job explicitly |
%- | Resume the previous job |
Examples
Resume the most recently suspended job in the background
bgResume job number 1 (shown in jobs output) in the background
bg %1Resume the job whose command starts with 'python' in the background
bg %pythonAfter Ctrl+Z suspends a job, type 'bg' to resume it, then use 'fg' to bring it forward again
fg; sleep 100 &Resume both job 2 and job 3 in the background simultaneously
bg %2 %3List all jobs first, then resume the one you want in the background
jobs; bg %1