# Browsing man pages (especially online)



## patmaddox (Sep 8, 2022)

I am familiar with https://www.freebsd.org/cgi/man.cgi

My trouble with it is that I need to know what I'm looking for, either a specific command or apropos. But I'm interested in a more exploratory approach, same as if I go to the handbook and start clicking around. Often times people will link to a man page that I never knew existed, wouldn't know to search for, and I'm not sure how I'd come across it other than via someone linking it.

Is there a simple, somewhat organized way to browse man pages? The closest I've come is apropos * which is a flat list of all man pages. It doesn't seem able to break down by section even (it always changes to "all sections").


----------



## Alain De Vos (Sep 9, 2022)

Personally i consider man pages having a more or less flat structure, i.e. not a tree.
Going smootly from one to another maybe some key-shortcuts from "less" ?
"less --help"


----------



## astyle (Sep 9, 2022)

patmaddox said:


> Often times people will link to a man page that I never knew existed, wouldn't know to search for, and I'm not sure how I'd come across it other than via someone linking it.


To me personally, that's kind of 'Nature of the beast'... When manpages first came about, typing `man someutility` was just a quick way of reading a manpage without having to thumb through an unwieldy physical book. If I don't even know what I'm looking for, I first define my task, like 'Compilation on command line', and Google will tell me that it's the `make` utility.

But... consider `man make`: Yeah, it will output the manpage for the make(1) utility. It's a pretty long page, with lots of options. To top it all off, `make` accepts a LOT more flags than what's described in its manpage - those additional flags are defined in the makefile. 

I guess if you want to explore, one approach would be to run `ls /usr/bin`, which will list a LOT of userland utilities, they usually would have a manpage associated with them... Yeah, cumbersome, but that's the original UNIX approach.

Doing a quick Google Search for 'linux manpages' led me to this : https://www.kernel.org/doc/man-pages/ - I think that you're looking for this kind of browsing. Just keep in mind, it's aimed at Linux, rather than FreeBSD... :/ My personal trouble with Linux is that basic stuff like `ifconfig` varies from distro to distro - some distros have it in /sbin, others have it in /usr/local/bin, others in /usr/libexec, the list can go on and on.

Another thing to keep in mind is that most packages will install their own manpages beyond what's in base install of FreeBSD. Online manpages reflect the base install. This is part of the reason ppl link to obscure manpages that you wouldn't find otherwise...  it's basically up to you to grab on a tiny bit of relevant info and use that to unearth a treasure trove.


----------



## mer (Sep 9, 2022)

man -k keyword
"list all the man pages that include the keyword"

similar to apropos keyword


----------



## SirDice (Sep 9, 2022)

astyle said:


> Online manpages reflect the base install.


Base and ports. The [man] bbcode we use on the forums links to "X.Y-RELEASE and ports". But there's some overlap with commands (or configuration files) that have the same name in different ports (or with the base). That can be somewhat confusing if you're not aware of this.


----------



## schweikh (Sep 9, 2022)

Well, if apropos (equal to man -k) does not cut it for you, you can grep a specific manual section with


```
$ find /usr/share/man/man1 -name '*.gz' | xargs zgrep foobar
/usr/share/man/man1/bsdcpio.1.gz:.Do foobar Dc :
/usr/share/man/man1/bsdcpio.1.gz:.Dl Nm find Pa src Fl mtime Ar +2 | Nm xargs Nm grep -l foobar | Nm Fl pdmu Pa dest
/usr/share/man/man1/chflags.1.gz:.Fa foobar
/usr/share/man/man1/chflags.1.gz:.Dl Nm Fl R Ar 0 Ar foobar
/usr/share/man/man1/cpio.1.gz:.Do foobar Dc :
/usr/share/man/man1/cpio.1.gz:.Dl Nm find Pa src Fl mtime Ar +2 | Nm xargs Nm grep -l foobar | Nm Fl pdmu Pa dest
/usr/share/man/man1/crunchgen.1.gz:.Qq Li foobar
/usr/share/man/man1/flex++.1.gz:For example, on the input "foobar" the following will write out
[...]
```

Augment the directory arguments to find(1) with `/usr/local/man/man1` to your liking.


----------



## SirDice (Sep 12, 2022)

[_Mod: removed a bunch of nonsense_]


----------



## hardworkingnewbie (Sep 12, 2022)

Man pages come in sections:

     The sections of the manual are:
           1.   FreeBSD General Commands Manual
           2.   FreeBSD System Calls Manual
           3.   FreeBSD Library Functions Manual
           4.   FreeBSD Kernel Interfaces Manual
           5.   FreeBSD File Formats Manual
           6.   FreeBSD Games Manual
           7.   FreeBSD Miscellaneous Information Manual
           8.   FreeBSD System Manager's Manual
           9.   FreeBSD Kernel Developer's Manual

To get a list of all man pages belonging to a section use this command which delivers all games:
$ apropos -s 6 .
banner(6) - print large banner on printer
caesar, rot13(6) - decrypt caesar ciphers
factor, primes(6) - factor a number, generate primes
fortune(6) - print a random, hopefully interesting, adage
grdc(6) - grand digital clock (curses)
intro(6) - introduction to games
morse(6) - reformat input as morse code
number(6) - convert Arabic numerals to English
pom(6) - display the phase of the moon
random(6) - random lines from a file or random numbers

What you are probably meaning is GNU Texinfo; since FreeBSD doesn't use GNU in its standard userland it does not offer this. Aside that the info would be only useful for GNU tools.


----------



## patmaddox (Sep 16, 2022)

Thanks for the suggestions, everybody. The thing that really precipitated this was finding forum links to build(7) and release(7) – I don't know how I would have come across them if it weren't for those links.



hardworkingnewbie said:


> $ apropos -s 6 .



This is super helpful, thank you! A list of man pages by sections is a really good start. Perhaps I could modify the online apropos CGI script to accept the section.

In this exploration I also learned that makewhatis(8) indexes any man pages that have been installed by ports, so they also show up in apropos.


----------



## bakul (Sep 16, 2022)

When I was first starting out with Unix, I looked at the man pages for everything in /bin, then everything in /usr/bin etc. I played with every command, and many options, exercising what I read in their man pages because I remember better if I actually use them. You can use the "See Also" section to explore related commands etc. Another thing you can do is cd to /usr/share/man/manN, for N in 1..9, and see what files exist there and explore. Also try "man N intro".


----------

