bg

Official Description

Runs jobs in the background.

Syntax

bg [job_id...]

Options

None

Oddities

If no job_id is given, the most recently suspended job is used.

Available on systems that support job control.

Used to get a stopped job to resume execution but remain in the background.

Example

$ cat buzz
#! /bin/ksh
integer x=17
while :
do
x=17
done
$
$ buzz
[1] + Stopped                  buzz   # Ctrl+Z
$
$ jobs
[1] + Stopped                  buzz    # Job buzz is stopped
$
$ bg %1                                # Get it going in the background
[1]     buzz&
$
$ jobs
[1] +  Running                 buzz    # Job buzz is running now,
                                       # in the background
$
				

Get Korn Shell Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.