xterm keep page from less in terminal after exit

二次信任 提交于 2019-12-10 15:10:36

问题


I often view files using less and want to remember what i have just seen in the file. However when I quit less by pressing the q key my xterm window removes the page of less showing the file and only shows my command prompt.

How do I keep the less output on my terminal when I quit?


回答1:


less -X

Use the -X option from the less man page described below:

   -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:


Actually, if you are using xterm (rather than some other program), the choice of whether to honor alternate-screen escape sequences can be done readily using a menu selection Enable Alternate Screen Switching (or resource setting). The less option does not apply to other programs such as vi.

In the manual, this is the titeInhibit, named after the termcap settings

  • ti (terminal initialization)
  • te (terminal ending)

and in the FAQ, this is Why doesn't the screen clear when running vi?.



来源:https://stackoverflow.com/questions/6977781/xterm-keep-page-from-less-in-terminal-after-exit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!