Job Control
Background process
Use & instruction into the background, but still the output stream is printed on the terminal, so use the time to pay attention to the output stream redirected to a file or / dev / null discard
tar -zcvf test.tgz ./data > /dev/null &
Management operations
Operation & instruction | parameter | significance |
---|---|---|
ctrl+z | - | Pause the current task |
fg | jobNumber need to use% indicated parameter job number instead of pid | Wake-up work, brought to the foreground |
bg | jobNumber need to use% indicated parameter job number instead of pid | Activate the pause of work, but then continue to run way station |
kill | % need to use marker signal JobNumber% job number instead of the designated parameter pid | Removal of background work |
jobs | -l Lists work PID -r -s suspend the running of the work of work | The current work status. Items in the list with a plus representation was recently suspended work directly issued fg command will quickly switch back to the work |
nohup | < something commond> | Offline executing instructions, general & commond will use for background execution, nohup does not support the direct use of Linux built-in command, bash or need to write custom instructions |
Some chestnuts:
# 唤醒
fg %2 或者 fg 激活最近被暂停的任务
# 激活
bg %1
# 移除
kill %5
# 列表信息
jobs -lrs
# 脱机使用
nohup ./startService.sh &