加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux-networking – STDOUT上的MTR结果?

发布时间:2020-12-13 17:09:48 所属栏目:Linux 来源:网络整理
导读:我正在尝试 mtr(我的traceroute)用于教育目的.然而,我无法管理它直接将结果打印到stdout是非常令人不安的. 默认情况下,它会打开一个GTK窗口,在其中打印结果.如果我使用选项-t我可以强制它在终端中使用ncurses. 但这根本没有用. 我无法将内容重定向到文件或管
我正在尝试 mtr(我的traceroute)用于教育目的.然而,我无法管理它直接将结果打印到stdout是非常令人不安的.
默认情况下,它会打开一个GTK窗口,在其中打印结果.如果我使用选项-t我可以强制它在终端中使用ncurses.
但这根本没有用.

>我无法将内容重定向到文件或管道(我可以,但有很多令人不安的东西,如ESC [?1049h来自ncurses左右).
>当我定义循环时,例如使用-r -c 1后,结果会在运行结束后立即从提示中消失.
>如果我停止程序,结果也会消失.

有没有办法使用这个程序“UNIX-way”?
我只想把结果输出到stdout,没有花哨的额外内容!

我已经在当前的debian wheezy上安装了包mtr.

$mtr --version
mtr 0.82

解决方法

尝试在Debian上使用mtr-tiny软件包,让它在没有GTK或ncurses的情况下运行.

mtr-tiny is compiled without support for X and conserves disk space.

root@mail:~# apt-cache show mtr-tiny
Package: mtr-tiny
Priority: optional
Section: net
Installed-Size: 120
Maintainer: Robert Woodcock <rcw@debian.org>
Architecture: amd64
Source: mtr
Version: 0.75-2
Replaces: mtr
Depends: libc6 (>= 2.7-1),libncurses5 (>= 5.6+20071006-3)
Conflicts: mtr,suidmanager (<< 0.50)
Filename: pool/main/m/mtr/mtr-tiny_0.75-2_amd64.deb
Size: 40740
MD5sum: 46cbf5da3e22772d34a7a696cc6648a5
SHA1: 40d6427a48c0dac7b6e31e0a9592ef6381445001
SHA256: 9a32f07375e09f11109cd207f8875647bd3f3b88170c071f3a13aca614182e15
Description: Full screen ncurses traceroute tool
 mtr combines the functionality of the 'traceroute' and 'ping' programs
 in a single network diagnostic tool.
 .
 As mtr starts,it investigates the network connection between the host
 mtr runs on and a user-specified destination host.  After it
 determines the address of each network hop between the machines,it sends a sequence ICMP ECHO requests to each one to determine the
 quality of the link to each machine.  As it does this,it prints
 running statistics about each machine.
 .
 mtr-tiny is compiled without support for X and conserves disk space.
Tag: interface::text-mode,network::scanner,protocol::ip,role::program,scope::utility,uitoolkit::ncurses,use::checking

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读