Using bg command in Linux (Examples)

bg command in Linux or Unix is actually a part of shell job control. This command’s primary purpose is to resume suspended jobs in system by running them in background. Technically, this command may be available as both, internal as well as external command. Also, this command can be used to restart a stopped process in background.

Also Read:   Linux cat Command [12 Basic Examples]

Syntax to use bg command in Linux

bg jobID
bg jobID1 jobID2…..

jobID can be specified in terms of:

%n: Indicates to job number n
%str: Indicates a job which is started by a command with suffix str
%?str: Indicates the job that is started by a command including str
%% | %+: Indicates to current job.
%-: Indicates to previous job

Also Read:   Using cc Command In Linux- Examples

Options to use with bg command in Linux

–help: Displays help information on screen and exits

Example of bg command

1: To view the help information of bg command

bg –help

2: To put a job number 3 in background

bg %3

Nishant

Nishant Verma is a senior web developer who love to share his knowledge about Linux, SysAdmin, and more other web handlers. Currently, he loves to write as content contributor for ServoNode.