linux-(fg_jobs)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux-(fg_jobs)相关的知识,希望对你有一定的参考价值。
在启动程序后,往往需要查看启动日志是否正常,有无报错,而有时日志量很大(刷屏),不易看清楚日志,这时就需要停下来,之前一直使用CRTL+C 直接退出,而后想看接下来的日志的话,日志已经刷好远了。。。。,今天发现一个将程序存放到后台的功能,需要时再调回前台查看就可以了,刚开始学linux时 知道有这功能,工作后一直没有用;今天用起来了,记录如下:
ping www.baidu.com 然后按 CRTL+Z,如下放到后台运行
[email protected]:~# ping www.baidu.com PING www.a.shifen.com (180.97.33.107) 56(84) bytes of data. 64 bytes from 180.97.33.107: icmp_seq=1 ttl=54 time=42.5 ms 64 bytes from 180.97.33.107: icmp_seq=2 ttl=54 time=42.4 ms ^Z [1]+ Stopped ping www.baidu.com
ping blog.51cto.com
[email protected]:~# ping blog.51cto.com PING 7c7rz4s17gs72353.alicloudlayer.com (116.211.167.193) 56(84) bytes of data. 64 bytes from 116.211.167.193: icmp_seq=1 ttl=46 time=27.5 ms 64 bytes from 116.211.167.193: icmp_seq=2 ttl=46 time=26.8 ms 64 bytes from 116.211.167.193: icmp_seq=3 ttl=46 time=27.9 ms ^Z [2]+ Stopped ping blog.51cto.com
ping docs.python.org
[email protected]:~# ping docs.python.org PING prod.python.map.fastlylb.net (151.101.16.223) 56(84) bytes of data. 64 bytes from 151.101.16.223: icmp_seq=1 ttl=44 time=513 ms 64 bytes from 151.101.16.223: icmp_seq=2 ttl=44 time=513 ms ^Z [3]+ Stopped ping docs.python.org
jobs 查看目前运行的后台程序
[email protected]:~# jobs [1] Stopped ping www.baidu.com [2]- Stopped ping blog.51cto.com [3]+ Stopped ping docs.python.org
fg 将最近后台运行程序(+)前台执行,这里为3 —ping docs.python.org
[email protected]:~# fg ping docs.python.org 64 bytes from 151.101.16.223: icmp_seq=4 ttl=44 time=491 ms 64 bytes from 151.101.16.223: icmp_seq=5 ttl=44 time=488 ms 64 bytes from 151.101.16.223: icmp_seq=7 ttl=44 time=489 ms 64 bytes from 151.101.16.223: icmp_seq=8 ttl=44 time=496 ms
可以看到基本上是从放入后台这个时间点运行到前台的
fg 1 将系列号为1的后台程序放入前台执行
[email protected]:~# fg 1 ping www.baidu.com 64 bytes from 180.97.33.107: icmp_seq=12 ttl=54 time=41.1 ms 64 bytes from 180.97.33.107: icmp_seq=13 ttl=54 time=42.1 ms 64 bytes from 180.97.33.107: icmp_seq=14 ttl=54 time=42.8 ms 64 bytes from 180.97.33.107: icmp_seq=15 ttl=54 time=41.2 ms
功能简单,但挺实用,记录一下!
本文出自 “天天向上goto” 博客,请务必保留此出处http://ttxsgoto.blog.51cto.com/4943095/1858213
以上是关于linux-(fg_jobs)的主要内容,如果未能解决你的问题,请参考以下文章
linux打开终端如何启动scala,如何在终端下运行Scala代码片段?
Android 逆向Linux 文件权限 ( Linux 权限简介 | 系统权限 | 用户权限 | 匿名用户权限 | 读 | 写 | 执行 | 更改组 | 更改用户 | 粘滞 )(代码片段
-bash: /usr/bin/ls: /lib64/ld-linux-x86-64.so.2: bad ELF interpreter: No such file or directory(代码片段