the FG and BG commands provided by Linux allow us to easily schedule tasks that are running
If you find a program that runs the day before it takes a long time, but you need to do the day before, you can hang up the program with Ctrl-z, and then you can see the system prompt:
[1]+ stopped/root/bin/rsync.sh
At this point the process is in a stopped state, and we can let it continue executing in the background
#bg 1
[1]+/root/bin/rsync.sh &
View tasks with the jobs command
[1]+ running/root/bin/rsync.sh &
Get it back to the front desk.
#fg 1
/root/bin/rsync.sh
This way, you can only wait for the task to complete on this console.
FG, BG, Jobs, &, CTRL + Z are all related to system tasks and have learned quite practical
First, & is most often used
This is used at the end of a command, you can put this command in the background to execute
Two, CTRL + Z
you can put a command that is executing in the foreground in the background, and Pause
Third, Jobs
See how many commands are currently running in the background
Iv. FG
Move commands in the background to the foreground to continue running
If there are multiple commands in the background, you can use FG%jobnumber to bring up the selected command,%jobnumber is the ordinal (not PID) of the command being executed in the background through the jobs command.
V. BG
A command that pauses in the background changes to continue execution
If there are multiple commands in the background, you can use BG%jobnumber to bring up the selected command,%jobnumber is the ordinal (not PID) of the command being executed in the background through the jobs command.
48491755
Linux task front and back console management (BG and FG commands)