How to follow a link in man

When looking at man-pages in the terminal I often come across words with bracketed numbers after them (like mkdir(2)). If I am not mistaken, these are links or references to other man-pages.

If so, how can I follow that link / find the referenced page?

If not, what does this mean?


Solution 1:

If you want to see all man pages about a command, one after the other, use the -a to man:

man -a mkdir

then use the SPACE bar, then q to quit the first page and then the ENTER key to see the next (2) page.

To find out more you can lookup the manpage of man using

man man

Solution 2:

Not with less(1), which is default pager in Ubuntu (and GNU in general).

There are several tools available, thing that works in terminal and is not a full-blown GNU Emacs is called info(1):

$ info apt

TAB to focus the next link M-TAB¹ — previous link, RET to follow a link under cursor, f (for ‘follow’, I guess) to ask which link to go, completion available (usual TAB for that).

Please note, that when started info(1) defaults to a proper Info documentation (if such exists), rather that manpages. If that is not what you want by some reason, you have to specify man section explicitly:

$ info 'mkdir(1)'     # that’s a man page

rather than:

$ info mkdir          # that’s a section in the full manual for Coreutils

__
¹ ESC TAB if meta-tab (which might or might not be the same as alt-tab) does not work in you terminal.