【问题标题】:xterm keep page from less in terminal after exitxterm 退出后在终端中保留页面
【发布时间】:2011-10-22 02:38:11
【问题描述】:

我经常使用 less 查看文件,并想记住我刚刚在文件中看到的内容。但是,当我按 q 键退出时,我的 xterm 窗口会删除显示文件的页面,并且只显示我的命令提示符。

当我退出时如何在终端上保持较少的输出?

【问题讨论】:

    标签: linux bash xterm less-unix


    【解决方案1】:

    少-X

    使用下面描述的 less 手册页中的 -X 选项:

       -X or --no-init
              Disables  sending  the  termcap  initialization and deinitialization strings to the terminal.
              This is sometimes desirable if the deinitialization string does something  unnecessary,  like
              clearing the screen.
    

    【讨论】:

      【解决方案2】:

      实际上,如果您使用xterm(而不是其他程序),可以使用菜单选项轻松选择是否支持备用屏幕转义序列启用备用屏幕切换 (或资源设置)。 less 选项不适用于其他程序,例如 vi

      在手册中,这是 titeInhibit,以 termcap 设置命名

      • ti(终端初始化)
      • te(终端结尾)

      在常见问题解答中,这是Why doesn't the screen clear when running vi?

      【讨论】:

        猜你喜欢
        • 2017-06-25
        • 2015-09-03
        • 2013-01-04
        • 2014-11-04
        • 2011-10-10
        • 2020-06-29
        • 2014-03-11
        • 2019-01-25
        • 2023-02-06
        相关资源
        最近更新 更多