Linux/Unix is different from Microsoft's platform. The biggest advantage is the real multi-user, multi-task. Therefore, there are also special management ideas in task management. We know that in windows, we either makeProgramThe service is always running in the background, or the service is stopped. The program cannot be switched between the foreground and background.
Linux provides FG and BG commands, allowing you to easily schedule running tasks.
Suppose you find it takes a long time to run a program on the front end, but you need to do other things, you can use ctrl-Z to terminate the program, and then you can see the system prompt:
[1] + stopped/root/bin/rsync. Sh
Then we can schedule the program to the background for execution: (the number following BG is the job number)
# BG 1
[1] +/root/bin/rsync. Sh &
Run the jobs command to view running tasks:
# Jobs
[1] + running/root/bin/rsync. Sh &
If you want to call it back to the foreground, you can use
# FG 1
/Root/bin/rsync. Sh
In this way, you can only wait for the task to be completed on the console.
& Drop the command to the background for execution
[CTRL] + z pause the foreground task to the background
Jobs view the working status of the background
FG % jobnumber: Get the background task to the foreground for processing
BG % jobnumber put the task to the background for processing
Kill tasks in the management background