I'm working on a Ubuntu Linux machine and I'm looking for a way to get the xterm to scroll when things are cleared rather than clearing the screen and showing the previous contents.

This may not make sense so a couple examples might. When I run vim in an xterm and hit ctrl-Z it wipes the screen and shows me the command prompt that I used to run the command. Instead I'd like to still be able to see what I was editing. Or when reading a man page I find the part I was looking for so I hit q to drop out and the screen clears and shows the command I used to launch that, but the information I wanted from the man page is gone.

I found that setting the TERM environment variable to vt100 gets me the scrollback that I want but doing that has drawbacks such as disabling colors and key actions in editors that look at TERM. For example in vim colors don't work and Page Down key no longer pages.

Is there a way to get both the scrollback and the features of TERM=xterm?

2 Answers 2


This command will turn the effect on for any XTerms started later:

echo XTerm*VT100.TiteInhibit: True|xrdb -merge

From xterm(1):

titeInhibit (class TiteInhibit)

Specifies whether or not xterm should remove ti and te termcap entries (used to switch between alternate screens on startup of many screen-oriented programs) from the TERMCAP string. If set, xterm also ignores the escape sequence to switch to the alternate screen. Xterm supports terminfo in a different way, supporting composite control sequences (also known as private modes) 1047, 1048 and 1049 which have the same effect as the original 47 control sequence. The default for this resource is “false.”

Put the line XTerm*VT100.TiteInhibit: True in your ~/.Xresources file if you want the effect to be permanent.

  • This works perfectly. Now I just have to figure out how to set this type of thing for every type of terminal. Thanks
    – Ed.
    Nov 13, 2009 at 22:39
  • @Ed: You could always ask here...
    – Teddy
    Nov 14, 2009 at 21:52
  • Your comments gave me enough information to search for the solution. Here's what I came up with infocmp > xterm.src edit xterm.src and remove rmcup and smcup entries tic xterm.src cp xterm ~/.terminfo/x/xterm
    – Ed.
    Nov 16, 2009 at 15:48

One thing you can do if you use less (also if it's the pager you're using for man) is to set LESS=X (plus whatever other defaults you have) in your ~/.bashrc file. This will cause less to leave what it was displaying on the screen when you exit.

  • man is using less as its pager on my system so this worked quite well for those things. It unfortunately didn't work for other things such as vim.
    – Ed.
    Nov 13, 2009 at 22:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.