fg

Move background jobs to the foreground terminal to run

Summary

fg [job_spec ...]

The main purpose

Parameters

job_spec (optional): Specifies the job identifier to be moved to the foreground for execution, which can be one or more.

return value

Returns the execution status of the job, or returns failure if an error occurs.

example

#Run the sleep command and press ctrl+z.
sleep 60
^Z
[1]+ Stopped sleep 60

# Use the fg command to run the job in the foreground.
fg%1

# returned messages:
sleep 60

Notice

  1. The job control commands of bash include bg fg kill wait disown suspend.

  2. This command can only be executed when the 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.

  3. This command is a built-in bash command. For related help information, please see the help command.

继续阅读

接下来你可能需要这些内容

优先推荐相关内容,同时保留你的阅读轨迹和收藏入口。