bg command in Linux (original) (raw)

Last Updated : 14 May, 2026

The bg command in Linux is used to resume a suspended job and run it in the background. It allows processes to continue execution without blocking the terminal.

Example

**Step 1: Start a long-running process (e.g., sleep 60).

sleep 60

**Step 2: Suspend the process by pressing Ctrl + Z.

**Output:

[1]+ Stopped sleep 60

**Step 3: Resume the suspended process in the background using bg.

bg

**Output:

[1]+ sleep 60 &

file

Output

Syntax

bg [job_spec ...]

where,

If no job_spec is provided, the most recent job is resumed in the background.

Useful Options for bg command

1. bg [JOB_SPEC]:

This command is used to run the mentioned job in the background.

Command:

jobs
sleep 500

Press: Ctrl + Z (to suspend the process)

jobs
bg %1
jobs

**Output:

bg [JOB_SPEC]The command sleep 500 creates a foreground job.

2. bg --help:

Displays the help information for the bg command. This is useful if you need more information.

Command:

bg --help

**Output:

bg --help