我正在尝试
mtr(我的traceroute)用于教育目的.然而,我无法管理它直接将结果打印到stdout是非常令人不安的.
默认情况下,它会打开一个GTK窗口,在其中打印结果.如果我使用选项-t我可以强制它在终端中使用ncurses.
但这根本没有用.
默认情况下,它会打开一个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