GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — linux-command/command/bg.md at master · javamickey/linux-command

Expand file tree

/

bg.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
48 lines (30 loc) · 1.19 KB
/

bg.md

Copy path

File metadata and controls

48 lines (30 loc) · 1.19 KB
Raw
Copy raw file
Download raw file
Outline
Edit and raw actions

bg

将前台终端作业移动到后台运行

概要

bg [job_spec ...]

主要用途

  • 用于将作业放到后台运行,使前台可以执行其他任务。该命令的运行效果与在指令后面添加符号&的效果是相同的,都是将其放到系统后台执行。

  • 若后台任务中只有一个,则使用该命令时可以省略任务号。

参数

job_spec(可选):指定要移动到后台执行的作业标识符,可以是一到多个。

返回值

返回成功除非未开启作业控制或发生了错误。

例子

# 运行sleep命令,然后按下ctrl+z。
sleep 60
^Z
[1]+  Stopped                 sleep 60

# 使用bg命令使得作业在后台运行。
bg %1

# 返回信息:
[1]+ sleep 60 &

注意

  1. bash的作业控制命令包括bg fg kill wait disown suspend。
  2. 该命令需要set选项monitor处于开启状态时才能执行;查看作业控制状态:输入set -o查看monitor行;执行set -o monitor或set -m开启该选项。
  3. 该命令是bash内建命令,相关的帮助信息请查看help命令。
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.