Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to escape out of the MAN screen or page in UNIX?

Tags:

unix

cygwin

I entered man ls. This shows a screen with the manual for ls. I want to close this manual and go back to the previous screen. How do I do it ? The man page for ls is not allowing me to do so. It keeps on showing "(END)" or some message when I try to type a unix command.

I am a newbie so please don't downvote me.

like image 869
bashboy Avatar asked Jul 24 '13 18:07

bashboy


People also ask

How do I exit screen mode in Linux?

Leaving Screen Terminal Session There are 2 (two) ways to leaving the screen. First, we are using “Ctrl-A” and “d” to detach the screen. Second, we can use the exit command to terminating the screen. You also can use “Ctrl-A” and “K” to kill the screen.

How do I exit TTY screen?

To exit a screen session, you can type exit or hit Ctrl+A and then D. You can now toggle back and forth between the two screen panes by using Ctrl+A+Tab.

How do I exit a Unix server?

exit-Issuing the exit command at the shell prompt will cause the shell to exit. In some cases, if you have jobs running in the background, the shell will remind you that they are running and simply return you to the command prompt. In this case, issuing exit again will terminate those jobs and exit the shell.


2 Answers

The man command uses your default pager, which is specified by $MANPAGER if it's set, or by $PAGER. If neither is set, it defaults to something reasonable, probably either more or less. (Oddly, I don't see this in the man page for the man command, which you can view by typing man man -- once you get back to your shell prompt.)

Most pagers can be exited by typing q -- which is going to be a useful thing to know for other programs that invoke your pager, or when you use your pager directly to view a file (less some-file.txt).

When I run the man command on my system, the bottom line shows:

Manual page ls(1) line 1 (press h for help or q to quit)

in reverse video. Do you see that? (You may or may not, depending on your settings.)

If your pager is less, then you can get more information by typing h for help -- or by typing man less.

like image 139
Keith Thompson Avatar answered Sep 28 '22 04:09

Keith Thompson


You can press the q key to exit the man pages.


FYI:

In my experience, the man generally uses less to display the information. To get a helpful list of keyboard shortcuts (navigation, exiting) for less (and for man), you can type in:

less --help

Here is a brief exerpt:

                   SUMMARY OF LESS COMMANDS

      Commands marked with * may be preceded by a number, N.
      Notes in parentheses indicate the behavior if N is given.

  h  H                 Display this help.
  q  :q  Q  :Q  ZZ     Exit.
 ---------------------------------------------------------------------------

                           MOVING

  e  ^E  j  ^N  CR  *  Forward  one line   (or N lines).
  y  ^Y  k  ^K  ^P  *  Backward one line   (or N lines).
  f  ^F  ^V  SPACE  *  Forward  one window (or N lines).
  b  ^B  ESC-v      *  Backward one window (or N lines).
  z                 *  Forward  one window (and set window to N).
  w                 *  Backward one window (and set window to N).
  ESC-SPACE         *  Forward  one window, but don't stop at end-of-file.
  d  ^D             *  Forward  one half-window (and set half-window to N).
  u  ^U             *  Backward one half-window (and set half-window to N).
  ESC-)  RightArrow *  Left  one half screen width (or N positions).
  ESC-(  LeftArrow  *  Right one half screen width (or N positions).
  F                    Forward forever; like "tail -f".
  r  ^R  ^L            Repaint screen.
  R                    Repaint screen, discarding buffered input.
        ---------------------------------------------------
        Default "window" is the screen height.
        Default "half-window" is half of the screen height.
like image 35
jh314 Avatar answered Sep 28 '22 06:09

jh314