One day Linux Command (19) jobs fg bg Job Management

Source: Internet
Author: User

Job: a process or a group of processes associated with pipelines/redirection.

Foreground: The environment in which the client session interacts with you.

Background: The environment that does not interact with you, but is related to the current terminal session. For example, if you cannot enter a background job or control a background job (for example, you cannot use Ctrl + C to disable it), the background job is also disabled when the current terminal session is closed.

Background: that is, the system background. There is no direct relationship with the terminal session.

Run in background Mode

&: Add & after executing the job command &. For example, $ echo file1> file2 &

CTRL + Z: press Ctrl + C to convert the job running in the foreground into a background and suspend it. Then run BG % <number> on the background.

Jobs

Syntax: jobs [-LRS]

Description: displays background tasks.

Parameters:

-L: Besides listing the job number and command string, the PID Number is also listed;-R: only listing the work in the background run;-S: only list the jobs that are being paused in the background.

FG BG

Syntax: FG/BG [% <number>]

Note: FG transfers jobs in the background to the foreground for execution. BG switches the background job from pending to running.

Parameter: % <number> number indicates the serial number of the background job, which can be queried by the jobs command.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.