拓展知识:linux后台、前台运行进程
1. 后台运行任务调到前台运行
# 1. 将任务放在后台继续运行
[root@server ~]#ping baidu.com > /dev/null &
[1] 33859
# 2. 查看后台任务列表
[root@server ~]#jobs
[1]+ Running ping baidu.com > /dev/null &
# 3. 将后台运行任务调到前台执行
[root@server ~]#fg 1
ping baidu.com > /dev/null
2.后台暂停任务放到前台运行
# 1. 运行ping命令后,使用Ctrl+z将前台任务放入后台暂停运行
[root@server ~]#ping baidu.com
PING baidu.com (220.181.38.251) 56(84) bytes of data.
64 bytes from 220.181.38.251 (220.181.38.251): icmp_seq=1 ttl=128 time=7.31 ms
64 bytes from 220.181.38.251 (220.181.38.251): icmp_seq=2 ttl=128 time=44.1 ms
^Z
[1]+ Stopped ping baidu.com
# 2. 查看后台任务列表
[root@server ~]#jobs
[1]+ Stopped ping baidu.com
# 3. 使用bg命令将后台暂停任务放入前台执行
[root@server ~]#bg 1
[1]+ ping baidu.com &
[root@server ~]#64 bytes from 220.181.38.251 (220.181.38.251): icmp_seq=3 ttl=128 time=7.42 ms
64 bytes from 220.181.38.251 (220.181.38.251): icmp_seq=4 ttl=128 time=7.84 ms
本文来自博客园,作者:echo勇往直前,转载请注明原文链接:https://www.cnblogs.com/wangrengang/p/16047453.html

浙公网安备 33010602011771号