输出向下滚动的终端

cd1*_*127 8 command-line

我目前决定在垂直配置下测试我的双显示器,我遇到了一个我以前从未遇到过的问题:我终端上的输入线离屏幕太远了!

我想知道是否有办法使输出向下滚动,以便输入行保持在顶部。

例如,正常的终端视图如下所示:

PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=46 time=28.3 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=46 time=13.7 ms
64 bytes from 8.8.8.8: icmp_req=3 ttl=46 time=19.1 ms
64 bytes from 8.8.8.8: icmp_req=4 ttl=45 time=20.8 ms
64 bytes from 8.8.8.8: icmp_req=5 ttl=45 time=15.6 ms
64 bytes from 8.8.8.8: icmp_req=6 ttl=46 time=15.3 ms
64 bytes from 8.8.8.8: icmp_req=7 ttl=46 time=15.3 ms
64 bytes from 8.8.8.8: icmp_req=8 ttl=45 time=14.3 ms
64 bytes from 8.8.8.8: icmp_req=9 ttl=45 time=14.3 ms
64 bytes from 8.8.8.8: icmp_req=10 ttl=45 time=15.5 ms
64 bytes from 8.8.8.8: icmp_req=11 ttl=45 time=16.9 ms
64 bytes from 8.8.8.8: icmp_req=12 ttl=45 time=16.3 ms
64 bytes from 8.8.8.8: icmp_req=13 ttl=45 time=20.0 ms
^C
--- 8.8.8.8 ping statistics ---
13 packets transmitted, 13 received, 0% packet loss, time 12017ms
rtt min/avg/max/mdev = 13.773/17.391/28.343/3.812 ms
me@my_computer:~$ 
Run Code Online (Sandbox Code Playgroud)

相反,我想要这样的东西:

me@my_computer:~$ 
rtt min/avg/max/mdev = 13.773/17.391/28.343/3.812 ms
13 packets transmitted, 13 received, 0% packet loss, time 12017ms
--- 8.8.8.8 ping statistics ---
^C
64 bytes from 8.8.8.8: icmp_req=13 ttl=45 time=20.0 ms
64 bytes from 8.8.8.8: icmp_req=12 ttl=45 time=16.3 ms
64 bytes from 8.8.8.8: icmp_req=11 ttl=45 time=16.9 ms
64 bytes from 8.8.8.8: icmp_req=10 ttl=45 time=15.5 ms
64 bytes from 8.8.8.8: icmp_req=9 ttl=45 time=14.3 ms
64 bytes from 8.8.8.8: icmp_req=8 ttl=45 time=14.3 ms
64 bytes from 8.8.8.8: icmp_req=7 ttl=46 time=15.3 ms
64 bytes from 8.8.8.8: icmp_req=6 ttl=46 time=15.3 ms
64 bytes from 8.8.8.8: icmp_req=5 ttl=45 time=15.6 ms
64 bytes from 8.8.8.8: icmp_req=4 ttl=45 time=20.8 ms
64 bytes from 8.8.8.8: icmp_req=3 ttl=46 time=19.1 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=46 time=13.7 ms
64 bytes from 8.8.8.8: icmp_req=1 ttl=46 time=28.3 ms
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
Run Code Online (Sandbox Code Playgroud)

我在论坛上找不到任何此类文档或问题。如果有人有想法,请告诉我!(如果你认为这是不可能的)

谢谢!

PS:我使用的是 Ubuntu 12.04

Rad*_*anu 5

我找到了一个很好的提示,您可以从中开始。你必须玩 bash:

要设置它:

$ bash    # try this in a subshell since ^C seems to cause it to exit
$ f () { sed "1s/^/$(tput cup 0 0)/;s/^/$(tput il1)/"; }
$ PROMPT_COMMAND='tput cup 0 0;tput il1; echo'
$ exec > >(f)
Run Code Online (Sandbox Code Playgroud)

再按一次 enter 就可以尝试了。有时输出和提示乱序,可能还有其他奇怪的地方,但尝试一下是一件很有趣的事情。

来源:反向终端/命令行窗口

也可以看看: