On several Unix servers, I have seen below behavior:

  • I list all the files using ls -lrt: 3 files are being shown up
  • I open one of the files using vi editor
  • I close the open file

Now in some Unix system, I can still see the earlier screen as it is as in point 2 (listing those 3 files, ls -lrt output as it is) whereas on some systems, the text of recently opened file is printed.

I want to know which setting in profile or some *rc file this behavior depends.

1 Answer 1


That sounds like the xterm alternate screen feature (implemented in most terminal emulators which have some similarity to xterm, including rxvt).

xterm maintains its output window in three parts:

  • the normal screen, as large as the window,
  • the scrollback, to which lines are copied as the window becomes full, and
  • the alternate screen, to which xterm can switch to/from when displaying "full-screen" programs.

The switching is done using an escape sequence. By convention, that may be part of the terminal description's initialization (and ending) capabilities: termcap ti and te or terminfo smcup and rmcup. This is a convention (neither termcap nor terminfo have a special capability for this feature), and since some users do, while others do not want it, the terminal descriptions differ.

Further reading:

Assorted advice (not all good, either way):

  • thanks Thomas.I will go through the links you have shared to get a better clarity !!!
    – Swapnil K
    Dec 16, 2015 at 9:27

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.