17

When I open up the manual for a command (man wget for example) the manual can be many hundreds of lines long. How can I get:

  • to the end of the manual quickly and
  • back to my terminal prompt?

4 Answers 4

24

When inside of the document viewer through the man command, press h or H in order to view the man's help.

From man's help screen:

JUMPING

  g  <  ESC-<       *  Go to first line in file (or line N).
  G  >  ESC->       *  Go to last line in file (or line N).
  p  %              *  Go to beginning of file (or N percent into file).

Another good idea would be to press the Home or the End keys. :)

Good luck!

2
  • 2
    Home, End, Page Up, Page Down, and the mouse scroll wheel all work as expected for me.
    – ændrük
    Mar 3, 2011 at 2:44
  • In the man bash interface, when I hit g and G I got to the top or the bottom, respectively. What does the < ESC-< part mean? I can type g then 7 then <enter> and it takes me to line 7, which is "line N" in the instructions but I couldn't tell you what made me try g 7 <enter> to get to line 7. p 50 <enter> does take me to what I believe to be half-way through the document so I guess I understand some of it but what's < ESC-< all about? Jun 28, 2022 at 19:45
5

The normal ways to do this have been suggested (see @geppettvs-dconstanzo's answer). This leaves numerous unnatural, wrong, and bad ways.

So I'll deal with a couple of those.


First, you don't have to read the man pages from a terminal (even though it will make you a better person). You can read them in html, for instance.

You can generate the html yourself from the sources on your system, but it's easier to go to manpages.ubuntu.com .

Here's the hefty bash page, turned into light and fluffy web-renderable html :
The Bash Manpage from manpages.ubuntu.com


Here's a hack that can actually be useful : use tail to slice off some number of lines from the end of the man page output, and view that.

Least usefully, most trivally:

man bash | tail -100

might be useful :

man bash | tail -1500 | more

(or man bash | tail -1500 | less)

More useful (if contrived):

$ man bash | wc -l    # how many lines are in the man-page?
5375
$ man bash | tail -2600 | less  # jump to the middle of the output

Of course, this is what I'd do:

man tac | tac | less

(Although you might start out reading man tac forwards.)

4

Some handy easy-to-remember less (and thus man) commands:

  • > takes you to the end of the file
  • < takes you back to the beginning
  • q exits less / man (as noted by @Kwinto)
  • / initiates typing a search term:
    • press enter to start searching
    • if you press enter immediately, it searches for the next occurrence of the last entered search term
    • n also searches (forward) to the next occurrence
    • N searches backwards to the previous occurrence

Hope that helps (:

2
  • Press G

  • Press q

You can type man less to get more information.

1
  • 1
    Man utility displays information with "pager", in Ubuntu default is "less", you can try "most" pager, it's has some cool features like displaying files in "windows", so you can view multiply file in one terminal, or even view several positions of a single file
    – user1128
    Mar 3, 2011 at 0:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .