What is Job management
work from the translation of the job command,the job command can view the process of working in the background. For example, what is job management, when you want to pack a larger directory, is time consuming, but you need to use another command at the same time. You'll think I can log in by opening a few terminals. In/etc/security/limits.conf, you can set the number of connections that users can log in at the same time, and if you set it to 1, isn't it? Can the program be packaged in the background because the time-consuming packaging commands do not need to interact with the user? The answer is yes.
Run a process into the background
Use the "&" symbol to make the command work in the background
#tar-ZCF Etc.tar.gz/etc &
This command will pack the/etc directory, which will be done in the background because of the & symbol added later
because the time is too short, we don't put the jobs command together.
use the shortcut key Ctel + z to put the current process into the background
#top
Execute the top command and press CTRL + Z, andthetop command will be placed in the background, but the top command will be paused at this point .
View current background process: jobs
# jobs [-lrs]
Options and Parameters:
-L: The number of the PID is also listed in addition to the list of job numbers and instruction strings;
-r: Lists only programs that run in the background;
-S: Lists only programs that are paused in the background.
Actually + represents a recent work process that has been put into the background-representing the last working process that was put in the background. And the third after the process, there will be no +/-symbol exists! |
restore a background paused process to the foreground execution:FG% work number
#fg%jobnumber
Options and Parameters:
%jobnumber:jobnumber is the work number. Note that the percent is optional!
Resume background paused process to background execution:bg% work number
#bg%jobnumber
Options and Parameters:
%jobnumber:jobnumber is the work number. Note that the percent is optional!
It is important to note that the ' backstage ' we refer to in our work management refers to a situation where the crtl]-c interrupt can be avoided in terminal mode, not in the background of the system. So, the background of work management is still related to the terminal! In this case, if you are connected to your Linux host in a remote connection, and will work in the way of & in the background, ask, in the case of the work is not over the situation you offline, the work will continue to do? The answer is ' no '! will not proceed, but be interrupted |