Move foreground terminal jobs to run in the background
bg [job_spec ...]
Used to run jobs in the background so that other tasks can be performed in the foreground. The running effect of this command is the same as adding the symbol &
after the command, both of which are executed in the background of the system.
If there is only one background task, the task number can be omitted when using this command.
job_spec (optional): Specifies the job identifier to be moved to the background for execution, which can be one or more.
Returns successful unless job control is not enabled or an error occurs.
#Run the sleep command and press ctrl+z.
sleep 60
^Z
[1]+ Stopped sleep 60
# Use the bg command to run the job in the background.
bg %1
# returned messages:
[1]+sleep 60&
bash
include bg fg kill wait disown suspend
.set
option monitor
is turned on; to view the job control status: enter set -o
to view the monitor
line; execute set -o monitor
or set -m
to turn it on this option.help
command.