Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It's not the command line history, it's the scrollback buffer of your terminal emulator.</p> <p>Commands that use curses or ncurses typically use escape sequences that save and restore the terminal's state on startup on exit. On startup, a sequence switches to a secondary display buffer, where the command displays all its output. On exit, another sequence switches back to the primary buffer and restores the cursor position. This lets you edit or view a file and then still see your shell command history when you're done.</p> <p>One workaround is to invoke <code>less</code> (or <code>vim</code>, or whatever) in another window, which you can leave running while still running commands in your shell. If you use <code>xterm</code>, for example, you can type something like:</p> <pre><code>command &gt; command.log ; xterm -e less -S command.log </code></pre> <p>which is easily wrapped in a function or script. If you're not in a GUI environment, <code>screen</code> can do something very similar.</p> <p>Another option, if you want the output of <code>less</code> to remain in your current window after you quit (which will scroll your shell command history off the top of the screen) is to use a <code>terminfo</code> definition that doesn't define those character sequences. The terminfo capability names are <code>tmcup</code> and <code>rmcup</code>. You may be able to configure your terminal emulator to disable these capabilities; see the <code>titeInhibit</code> resource for <code>xterm</code>, for example.</p> <p>(There <em>should</em> be an easier way to do this, but I haven't found it.)</p> <p><strong>UPDATE :</strong></p> <p>As <a href="https://stackoverflow.com/a/19300861/827263">DigitalTrauma's answer</a> points out, the <code>-X</code> (or <code>--no-init</code>) option to <code>less</code> inhibits the termcap/terminfo initialization and deinitialization strings (<code>ti</code>/<code>te</code> in termcap, <code>smcup</code>/<code>rmcup</code> in terminfo). Either adding <code>-X</code> to the <code>less</code> command-line options, or adding <code>X</code> to the <code>$LESS</code> environment variable, should do the trick.</p> <p>Note that this applies only to <code>less</code>. Other full-screen commands, such as text editors, will still save and restore the screen by default. Using the <code>titeInhibit</code> resource for <code>xterm</code>, or hacking your <code>termcap</code> or <code>terminfo</code> entry to remove those escape sequences, will provide a more general solution.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload