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