Article Directory
Preface
Work management allows a certain program to be executed in the background in the system.
Is there such a function in windows? ? ? In fact, there is, that is, a program is minimized, and the program is put into the background, and then it continues to run in the background.
1. Put the process in the background
Command: tar -zcf etc.tar.gz /etc &
Function: Put the compression process in the background for execution
Command: top
Description: During the execution of the top command, press the ctrl+z shortcut
Tips: (1) & put in the background is still running
(2) when a command is executed, ctrl + z put in the background, this method, put in the background will stop running, unless the foreground or background is restored carried out.
(3) Ctrl + c forcibly terminates. ctrl +z is placed in the background to pause, this command is not running, but placed in the background, but placed in the background is paused, not running.
2. View background work
Command: jobs [-l]
Option: -l
Display the PID of the job
Remarks: (1) The “+” sign represents the first job to be put into the background, and it is also the job resumed by default when the job is resumed. The "-" sign represents the second-to-last job put into the background. , You can also resume work according to the job number. (2) Jobs means work, so it is also called work management.
Start experiment:
Remarks:
+ represents the last job put into the background
- represents the penultimate job put into the background
3. Restore suspended work in the background to the foreground
Command: fg %工作号
(Foreground)
Parameter: % sign can be omitted, but pay attention to the difference between work number and PID
4. Restore the suspended work in the background to the background execution
Command: bg %工作号
(background)
Note: The command to resume execution in the background cannot interact with the foreground, otherwise it cannot resume execution in the background
Note again : The top command must have an interactive command with the foreground. If it runs in the background, it has no meaning.
For example, there is vi. Commands like top and vi cannot be executed even if they are added & placed in the background. Can only be suspended in the background.