Practical Tips: Use the background tasks of Linux OS

Source: Internet
Author: User
Article Title: Practical Tips: use Linux background tasks. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Linux, as a multi-task environment, allows users to execute multiple tasks at the same time, such as viewing system conditions, backing up data, editing files, and printing files.

A time-consuming task should not be executed in the foreground task, but should be handed over to the background task for execution. In this way, the foreground task can continue to operate normally without waiting. Example:

# Find/-name testing &

# Fg

If you want to convert the task in the preceding example to background execution, use "&". However, because the program is executed in the background, the output of the program will not appear on the screen. How do you manage multiple tasks in the background when they are executed? How do I know the execution of background tasks? How can I terminate or temporarily stop the execution of background tasks? Next we will illustrate it one by one.

Control Management

Example:

# Du-a/user> user. data &

[1] 237

# Find/-name core-type f-ls> core. data &

[2] 238

Run the "&" command to put the three tasks in the background for execution. Run the "jobs-l" command to display the execution of background tasks, for example:

# Jobs-l

[1] + 237 Running du-a/user> user. data

[2]-238 Running find/-name core-type f-ls> core. data

First, we will introduce a special term of task control: current task. The preceding task is "du-a/user> user. data", because the background task number is "[1]". If the first background task is successfully executed and the second background task is still in progress, the current task automatically becomes a background task with the background task number [2. So we can conclude that the current task will change. When you enter commands such as "fg", "bg", and "stop", if no quotation marks are added, all changes are made to the current task.

[1] [2] Next page

Related Article

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.