Skip to main content
replaced http://unix.stackexchange.com/ with https://unix.stackexchange.com/
Source Link

"Clearing" and "restoring" the screen is actually a function of the terminal emulator you are using (xterm, gnome-terminal, konsole, screen).

By default, the pager that man uses is less.

From man 1 man

   -P  pager
          Specify  which pager to use.  This option overrides the 
          MANPAGER environment variable, which in turn overrides 
          the PAGER variable.  By default, man  uses /usr/bin/less -is.

When less is invoked, an altscreen is launched by the terminal emulator to display the contents of the man page. When less exits, the altscreen is destroyed and the terminal displays what was saved in the buffer.

There is an answer herehere which discusses this further and how to keep programs like less from launching an altscreen and thus clearing the screen when it exits. In a nutshell, you could define an environment variable so that less does not launch an altscreen on invocation. If you are using bash, place this in ~/.bashrc:

export MANPAGER="/usr/bin/less -r -X -is"

"Clearing" and "restoring" the screen is actually a function of the terminal emulator you are using (xterm, gnome-terminal, konsole, screen).

By default, the pager that man uses is less.

From man 1 man

   -P  pager
          Specify  which pager to use.  This option overrides the 
          MANPAGER environment variable, which in turn overrides 
          the PAGER variable.  By default, man  uses /usr/bin/less -is.

When less is invoked, an altscreen is launched by the terminal emulator to display the contents of the man page. When less exits, the altscreen is destroyed and the terminal displays what was saved in the buffer.

There is an answer here which discusses this further and how to keep programs like less from launching an altscreen and thus clearing the screen when it exits. In a nutshell, you could define an environment variable so that less does not launch an altscreen on invocation. If you are using bash, place this in ~/.bashrc:

export MANPAGER="/usr/bin/less -r -X -is"

"Clearing" and "restoring" the screen is actually a function of the terminal emulator you are using (xterm, gnome-terminal, konsole, screen).

By default, the pager that man uses is less.

From man 1 man

   -P  pager
          Specify  which pager to use.  This option overrides the 
          MANPAGER environment variable, which in turn overrides 
          the PAGER variable.  By default, man  uses /usr/bin/less -is.

When less is invoked, an altscreen is launched by the terminal emulator to display the contents of the man page. When less exits, the altscreen is destroyed and the terminal displays what was saved in the buffer.

There is an answer here which discusses this further and how to keep programs like less from launching an altscreen and thus clearing the screen when it exits. In a nutshell, you could define an environment variable so that less does not launch an altscreen on invocation. If you are using bash, place this in ~/.bashrc:

export MANPAGER="/usr/bin/less -r -X -is"

added 41 characters in body
Source Link
George M
  • 14.3k
  • 4
  • 45
  • 53

"Clearing"Clearing" and "restoring" the screen"screen is actually a function of the terminal emulator you are using (xterm, gnome-terminal, konsole, screen).

By default, the pager that man uses is less.

From man 1 man

   -P  pager
          Specify  which pager to use.  This option overrides the 
          MANPAGER environment variable, which in turn overrides 
          the PAGER variable.  By default, man  uses /usr/bin/less -is.

When less is invoked, an altscreen is launched by the terminal emulator to display the contents of the man page. When less exits, the altscreen is destroyed and the terminal displays what was saved in the buffer.

There is an answer here which discusses this further and how to keep programs like less from launching an altscreen and thus clearing the screen when it exits. In a nutshell, you could define an environment variable so that less does not launch an altscreen on invocation. If you are using bash, place this in ~/.bashrc:

export MANPAGER="/usr/bin/less -r -X -is"

"Clearing the screen" is actually a function of the terminal emulator you are using (xterm, gnome-terminal, konsole, screen).

By default, the pager that man uses is less.

From man 1 man

   -P  pager
          Specify  which pager to use.  This option overrides the 
          MANPAGER environment variable, which in turn overrides 
          the PAGER variable.  By default, man  uses /usr/bin/less -is.

When less is invoked, an altscreen is launched to display the contents of the man page. When less exits, the altscreen is destroyed and the terminal displays what was saved in the buffer.

There is an answer here which discusses this further and how to keep programs like less from launching an altscreen and thus clearing the screen when it exits. In a nutshell, you could define an environment variable so that less does not launch an altscreen on invocation. If you are using bash, place this in ~/.bashrc:

export MANPAGER="/usr/bin/less -r -X -is"

"Clearing" and "restoring" the screen is actually a function of the terminal emulator you are using (xterm, gnome-terminal, konsole, screen).

By default, the pager that man uses is less.

From man 1 man

   -P  pager
          Specify  which pager to use.  This option overrides the 
          MANPAGER environment variable, which in turn overrides 
          the PAGER variable.  By default, man  uses /usr/bin/less -is.

When less is invoked, an altscreen is launched by the terminal emulator to display the contents of the man page. When less exits, the altscreen is destroyed and the terminal displays what was saved in the buffer.

There is an answer here which discusses this further and how to keep programs like less from launching an altscreen and thus clearing the screen when it exits. In a nutshell, you could define an environment variable so that less does not launch an altscreen on invocation. If you are using bash, place this in ~/.bashrc:

export MANPAGER="/usr/bin/less -r -X -is"

Source Link
George M
  • 14.3k
  • 4
  • 45
  • 53

"Clearing the screen" is actually a function of the terminal emulator you are using (xterm, gnome-terminal, konsole, screen).

By default, the pager that man uses is less.

From man 1 man

   -P  pager
          Specify  which pager to use.  This option overrides the 
          MANPAGER environment variable, which in turn overrides 
          the PAGER variable.  By default, man  uses /usr/bin/less -is.

When less is invoked, an altscreen is launched to display the contents of the man page. When less exits, the altscreen is destroyed and the terminal displays what was saved in the buffer.

There is an answer here which discusses this further and how to keep programs like less from launching an altscreen and thus clearing the screen when it exits. In a nutshell, you could define an environment variable so that less does not launch an altscreen on invocation. If you are using bash, place this in ~/.bashrc:

export MANPAGER="/usr/bin/less -r -X -is"