Monday, July 25, 2022

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

Issue

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.


Solution

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.



Answered By - Keith Thompson
Answer Checked By - Timothy Miller (WPSolving Admin)