bg
Quick Reference
Command Name:
bg
Category:
process management
Platform:
linux
Basic Usage:
Common Use Cases
Syntax
bg [job_spec...]
Options
Option | Description |
---|---|
job_spec | Specifies the job to continue in the background. If no job is specified, the most recently suspended job is used. |
Job Specification Formats:
Format | Description | Example |
---|---|---|
%n | Job number n | bg %1 |
%str | Job whose command begins with str | bg %find |
%?str | Job whose command contains str | bg %?log |
%% | Current job | bg %% |
%+ | Current job (same as %%) | bg %+ |
%- | Previous job | bg %- |
Examples
How to Use These Examples
The examples below show common ways to use the bg
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
Basic Examples:
# Suspend a running process with Ctrl+Z, then resume it in background sleep 100 # Press Ctrl+Z to suspend bg # The sleep command now runs in the background
Advanced Examples:
# Start a command, suspend it, and continue in background with output redirection find / -name "*.log" > logs.txt # Press Ctrl+Z to suspend bg # Now find continues in background with output still going to logs.txt