shell——bg fg jobs小技巧

正在执行的脚本用ctrl+z暂停,然后jobs查看后台作业号,然后bg+[作业号]挂到后台执行,或者fg+[作业号]拉到前台继续执行。

[root@test1 text]# sh test.sh
^Z
[1]+  Stopped                 sh test.sh
[root@test1 text]# jobs
[1]+  Stopped                 sh test.sh
[root@test1 text]# fg 1
sh test.sh
^Z
[1]+  Stopped                 sh test.sh
[root@test1 text]# jobs
[1]+  Stopped                 sh test.sh
[root@test1 text]# bg 1
[1]+ sh test.sh &
[root@test1 text]# fg 1
sh test.sh

 

posted @ 2017-03-14 09:34  沄持的学习记录  阅读(514)  评论(0)    收藏  举报