Which method of navigating man pages will repeat the previous search in the reverse direction?

This chapter is from the book

Within a particular section's screen, to move down, or forward, one line at a time, use the down arrow; to move up, or back, one line at a time, use the up arrow. When you reach the bottom, or end, of a particular section, your cursor stops and you are not able to proceed.

If you instead want to jump down a screen at a time, use your keyboard's PageDown button; to jump up a screen at a time, use the PageUp key instead. You are not able to leave the particular section you're in, however.

If you reach the end of the section and you want to jump back to the top, just press b, which stands for beginning. Likewise, e takes you to the "end."

If, at any time, as you're jumping around from place to place, you notice that things look a little strange, such as the letters or words being distorted, press Ctrl+l to redraw the screen, and all should be well.

Now that you know how to navigate within a particular section or node, let's move on to navigating between nodes. If you don't want to use PageDown and PageUp to move forward and backward within a section, you can instead use the spacebar to move down and the Backspace or Delete keys to move up. These keys offer one big advantage over PageDown and PageUp, besides being easier to reach: When you hit the end of a node, you automatically proceed onward to the next node, through subnodes if they exist. Likewise, going up moves you back to the previous node, through any subnodes. Using the spacebar, or the Backspace or Delete buttons, you can quickly run through an entire set of Info pages about a particular command.

If you want to engage in fewer key presses, you can use n (for next) to move on to the next node at the same level. If you are reading a node that had subnodes and you press n, you skip those subnodes and move to the next node that's a peer of the one you're currently reading. If you reading a subnode and press n, however, you jump to the next subnode. If n moves you to the next node at the current level, then p moves you to the previous one (p for previous, get it?), again at the same level.

If you instead want to move forward to a node or subnode, use the ], or right square brace, key. If you're reading a node and you press ], you'll jump to that node's first subnode, if one exists. Otherwise, you'll move to that node's next peer node. To move backward in the same fashion, use the [, or left square brace, key.

If you want to move up a node, to the parent of the node you're currently reading, use the u (for up) key. Be careful, though—it's easy to jump up past the home page of the command you're reading about in Info to what is termed the Directory node, the root node that leads to all other Info nodes (another way to reach the Directory node is to type d , for directory, at any time).

The Directory node is a particularly large example of a type of page you find all throughout Info: a Menu page, which lists all subnodes or nodes. If you ever find yourself on a Menu page, you can quickly navigate to one of the subnodes listed in that menu in one of two ways. First, type an m (for menu) and then start typing the name of the subnode to which you want to jump. For instance, here's the first page you see when you enter info info on the command line:

File: info.info, Node: Top, Next: Getting Started, Up: (dir) Info: An Introduction ********************* The GNU Project distributes most of its on-line manuals in the "Info format", which you read using an "Info reader" . You are probably using an Info reader to read this now. [content condensed due to length] * Menu: * Getting Started:: Getting started using an Info reader. * Expert Info:: Info commands for experts. * Creating an Info File:: How to make your own Info file. * Index:: An index of topics, commands, and variables.

To jump to Expert Info, you could type m , followed by Exp . At this point, you could finish typing ert Info , or you could just press the Tab key and Info fills in the rest of the menu name that matches the characters you've already entered. If Info complains, you have entered a typo, or more than one menu choice matches the characters you've typed. Fix your typo, or enter more characters until it is obvious to Info which menu choice is the one in which you're interested. If you realize that you don't want to go to a Menu choice at this time, press Ctrl+g to cancel your command, and go back to reading the node on which you find yourself.

Alternatively, you could just use your up or down arrow key to position the cursor over the menu choice you want, and then press Enter. Either method works.

If you don't want to navigate Info pages and instead want to search, you can do that as well, in two ways: By searching just the titles of all nodes for the Info pages about a particular command, or by searching in the actual text of all nodes associated with a particular command. To search the titles, enter i (for index because this search uses the node index created by Info), followed by your search term, and press Enter. If your term exists somewhere in a node's title, you'll jump to it. If you want to repeat your search and go to the next result, press the comma key.

If you want to search text instead of titles, enter s (for search), followed by your search term or phrase, and then press Enter. To repeat that search, enter s , followed immediately by Enter. That's not as easy as just pressing the comma key like you do when you're searching titles, but it does work.

If at any time you get lost inside Info and need help, just press the ? key and the bottom half of your window displays all of the various options for Info. Move up and down in that section using the keys you've already learned. When you want to get out of help, press l.

Finally, and perhaps most importantly, to get out of Info altogether, just press q, for quit, which dumps you back in your shell. Whew!

Which method of navigating man pages will repeat the previous search in the reverse direction?
Photo by Kelly Sikkema on Unsplash

The man page is software documentation for Unix or Unix-like operating systems. It displays online manual pages. Here, online means on the computer, not on the internet. Some commands have tens of thousand of pages. It can be overwhelming to read a man page just to find the information you need.

In this article, you’ll learn how to find an option description, pick up a script to find an option description, learn how to navigate, figure out how to get help, and learn more about man pages.

1. How To Navigate the Man Page

You can navigate man pages using the less command.

To move forward one line, use j ( or e, ^E, ^N, or the Return key). If you use a number, like 5j ( or 5e, 5^E, 5^N, etc.) you move five lines forward. (Here, ^E means the Ctrl key plus the letter e. There’s no difference between a capital or lowercase letter when using the Ctrl key.) If you are a Vim user, 5j is for you.

To move backward one line, use k ( or ^Y, y, ^K, or ^P). Again. you can use a number, like 5k ( or 5^Y, 5y, 5^K, 5^P, etc.) to move five lines backward.

To move to the top, use g.
To move to the end of the manual. use G.

To move forward one window, use f ( or ^F, ^V, or space).
To move backward one window, use b ( or ^B or ESC-v).

To move one-half window forward, use d (or ^D).
To move one-half window backward, use u (or ^U).

To shift the view to the right or left, use the right and left arrows.

How to jump to an option

On the manual, pressing / brings up the entry prompt to search forward for matching patterns.

For example, to find the option -h in the ls command:

Which method of navigating man pages will repeat the previous search in the reverse direction?
The output from man ls and using /-h to search. Image by the author.

To continue the search, press n to find the next match.

When you’re on a man page, hit h to display the LESS COMMANDS help page, and hit q to quit the page.

Which method of navigating man pages will repeat the previous search in the reverse direction?
LESS page. Hit h in a man page to show this page. Image by the author.

Read more about LESS.

Here’s a Bash script to display the description for the wget option -b:

You need to change the command and the option you’re looking for.

It’s hard to remember this. The next tip shows you a script that creates a command to find an option description at ease.

I created a Bash script called manop. This script finds an option description from the man page or the builtin help page. And it’s also able to display the command description.

Please see the update version in the following article.

Create an executable file called manop in the ~/bin directory.

Add the $HOME/bin directory in the PATH variable. (Read more details about how to set it up.)

Copy and paste manop:

Find the help:

Which method of navigating man pages will repeat the previous search in the reverse direction?
A part of manop help. Image by the author.

Use manop command-name option to display the option description and manop command-name to display the command description:

Which method of navigating man pages will repeat the previous search in the reverse direction?
The output from the manop command. Image by the author.

Here, the read command is one of the built-in commands.

Which method of navigating man pages will repeat the previous search in the reverse direction?
The output from a manop read and a manop read -d. Image by the author.

Use a -t flag to trim spaces:

Which method of navigating man pages will repeat the previous search in the reverse direction?
The output of manop -t ls -h. Image by the author.
Which method of navigating man pages will repeat the previous search in the reverse direction?
The output of manop -t col. Image by the author.

Built-in commands aren’t in man pages. Let’s find all the built-in commands:

Which method of navigating man pages will repeat the previous search in the reverse direction?
The outputs from the help command. Image by the author.

Use the help command to find out more about the function command:

Which method of navigating man pages will repeat the previous search in the reverse direction?
From the outputs of help read. Image by the author.

When you hit man man, you get the manual for the man command.

Which method of navigating man pages will repeat the previous search in the reverse direction?
The output from man man. Image by the author.

In the above image, you see man(1) at the top right.

Which method of navigating man pages will repeat the previous search in the reverse direction?
The output from man ls. Image by the author.

Here you can see LS(1) by hitting man ls:

Which method of navigating man pages will repeat the previous search in the reverse direction?
The output from man ls. Image by the author.

The cron man page has the number 8, CRON(8).

These numbers are not the version numbers. They stand for the manual sections.

Which method of navigating man pages will repeat the previous search in the reverse direction?
From the output from man man. Image by the author.

The ls command is under the Executable programs or shell commands section, and the cron is under the System administration commands section.

Where is the man page located?

Use the man -w command to display all paths to the man pages.

The output from macOS:

Which method of navigating man pages will repeat the previous search in the reverse direction?
The output from my macOS. Image by the author.

Since I use GNU/Linux commands on macOS, there are more outputs.

The output from Ubuntu:

Which method of navigating man pages will repeat the previous search in the reverse direction?
The output from Ubuntu. Image by the author.

Use the following command to find the man directories in the /usr/local/share/man directory in macOS:

On macOS bash shell:

Which method of navigating man pages will repeat the previous search in the reverse direction?
The output from the macOS bash shell. Image by the author.

On Ubuntu (Multipass) in the /usr/share/man directory:

Which method of navigating man pages will repeat the previous search in the reverse direction?
The output from Ubuntu. Image by the author.

The numbers after man are again the section numbers. The man1 directory contains Executable programs or shell commands.

There are some commands in different sections of man pages. For example, unlink has two entries in the image below.

Which method of navigating man pages will repeat the previous search in the reverse direction?
The output of whatis unlink. Image by the author.

Use man 1 unlink to see the unlink in section 1:

For section 2:

The man page is extremely useful, but it’s sometimes overwhelming and hard to navigate. I use the manop command every day to find option descriptions and command descriptions. I hope you find it useful too.

Now you know how to navigate the man page, how to get help when you\re stuck, and how to find a man page that has more than one entry.

I hope these tips will improve your productivity when you’re using the man page.