Linux 中的 bg 命令及示例
linux 中的bg命令用于将前台作业置于后台。
句法:
bg [job_spec ...]
job_spec可能是:
%n
: Refer to job number n.%str
: Refer to a job which was started by a command beginning with str.%?str
: Refer to a job which was started by a command containing str.%% or %+
: Refer to the current job. fg and bg will operate on this job if no job_spec is given.%-
: Refer to the previous job.
bg 命令的选项:
- bg [JOB_SPEC] :此命令用于将提到的作业置于后台。在下面的屏幕截图中,我们执行以下操作:
- 我们使用 jobs 命令列出所有作业
- 我们使用 sleep 命令创建一个进程,我们得到它的 ID 为 1。
- 我们通过将其 ID 提供给 bg 将其置于后台。
'sleep 500'用于创建虚拟前台作业。 - bg –help :此命令显示帮助信息。