Manual Pages and Info FilesThe most comprehensive documentation on MidnightBSD is in the form of manual pages. Nearly every program on the system comes with a short reference manual explaining the basic operation and available arguments. Manual pages are always available offline and are considered the authoritative reference for the commands, system calls, file formats, and devices that ship with the operating system.
Manual pages are intentionally terse. They document what a command does and what options it accepts, but they are not tutorials. For step-by-step guides and conceptual explanations, consult the documentation on this website or the FreeBSD Handbook, whose coverage of base system topics applies equally to MidnightBSD.
MidnightBSD manual pages are also available online at man.midnightbsd.org. This is useful for looking up documentation from another machine or when the system is not available.
Manual pages are viewed with the man command:
man command
For example, to read the manual page for ls:
man ls
To read the manual page for man itself:
man man
Manual pages open in a pager (usually less or more) so you can
scroll through them. Press q to quit. See the
Pager Navigation section for a full list of navigation keys.
References to manual pages in written documentation use parenthetical section numbers,
such as ls(1) or chmod(2). The number indicates which section
of the manual contains that entry. This notation is a hint that you can look up the
topic with man.
Manual pages are divided into numbered sections representing the type of topic. In MidnightBSD the following sections are available:
ls(1), cp(1), and grep(1).open(2), fork(2), and
read(2).printf(3), malloc(3), and strcmp(3)./dev, such as
ada(4) and em(4).fstab(5), rc.conf(5), and
passwd(5).hier(7) (the file system hierarchy)
and environ(7) (the process environment).mount(8), fsck(8),
and sysctl(8).malloc(9) and
mutex(9).A quick way to remember: sections 1 and 8 cover commands (user and admin respectively), sections 2 and 3 cover programming interfaces, section 4 covers drivers, and section 5 covers configuration file formats.
In some cases, the same topic name appears in more than one section. For example,
chmod is both a user command (section 1) and a C library system call
(section 2). Running man chmod without a section number displays the
first match found, which may not be the one you want.
To display the manual page from a specific section, provide the section number before the topic name:
man 1 chmod
man 2 chmod
Other examples where specifying the section matters:
man 5 passwd
man 4 ada
man 8 mount
man 3 printf
To see all available sections for a given name, use the -a flag. Each
matching manual page is displayed in turn; press q to advance to the
next one:
man -a chmod
If you do not know the exact name of a command or function, use man -k to
search the short description of every manual page for a keyword:
man -k mail
This displays a list of manual page entries whose descriptions contain the word
"mail". The output format is name(section) — description. This is
equivalent to the apropos command:
apropos mail
To search for an exact command name match rather than a keyword, use
whatis. It shows only entries whose name exactly matches the argument:
whatis chmod
To read the short descriptions for all commands in a directory:
cd /usr/sbin
whatis * | more
The apropos and whatis databases are built from the manual
pages installed on the system. If they return no results after installing new software,
rebuild the database as root:
makewhatis
Most manual pages follow a standard structure. Knowing these sections makes it faster to find the information you need:
whatis and apropos.[ ]) enclose optional arguments. An ellipsis (...)
means the argument may be repeated. Items in italics or
underline are placeholders for values you supply.When reading an unfamiliar manual page, start with NAME for a quick summary, then SYNOPSIS to understand the argument structure, then DESCRIPTION for the details. Check SEE ALSO to find related pages that may be more relevant to your task.
Manual pages are displayed through a pager. The default pager is set by the
PAGER environment variable; less is the most common choice.
See the Shells documentation for how to set
PAGER.
Key bindings when reading a manual page in less:
Space or f — scroll forward one screenb — scroll backward one screend — scroll forward half a screenu — scroll backward half a screenj or Down — scroll down one linek or Up — scroll up one lineg — go to the beginningG — go to the end/pattern — search forward for a pattern?pattern — search backward for a patternn — repeat the last search forwardN — repeat the last search backwardh — display help for less itselfq — quitTo open a manual page at the first occurrence of a search term directly:
man -P "less -p pattern" command
To display a manual page formatted as plain text (useful for saving or piping):
man -P cat ls
The man command searches a list of directories defined by the
MANPATH environment variable. The default path includes
/usr/share/man for the base system and /usr/local/share/man
for software installed via mports.
If you install software to a non-standard location, add its manual directory to
MANPATH in your shell startup file:
export MANPATH="/usr/share/man:/usr/local/share/man:/opt/myapp/man"
In tcsh:
setenv MANPATH "/usr/share/man:/usr/local/share/man:/opt/myapp/man"
To see the directories man is currently searching:
man --path
Manual pages for mports software are installed automatically when you install a
package. They are placed in /usr/local/share/man, which is included
in the default search path.
To display the manual page for a program installed in /usr/local
without setting MANPATH:
man -M /usr/local/share/man command
MidnightBSD includes several applications and utilities produced by the Free Software Foundation (FSF). In addition to manual pages, these programs may include hypertext documents called info files. Info files use a node-and-link structure similar to a web page, allowing you to navigate between topics.
Info files are typically more detailed than manual pages for GNU software such as
gcc, make, and the GNU C library. If a manual page's SEE
ALSO section references an info file, the info file is likely the more complete
reference.
To open the info reader at the top-level directory of all installed info files:
info
To open the info documentation for a specific program:
info make
info gcc
Navigation inside the info reader:
h — display a brief introduction to info navigation? — display a quick command referenceSpace — scroll forward through the current nodeBackspace — scroll backward through the current noden — go to the next node at the same levelp — go to the previous node at the same levelu — go up to the parent nodet — go to the top node of the current documentd — go to the top-level info directorys pattern — search for a pattern in the current fileEnter — follow a cross-reference linkl — go back to the last node visitedq — quitIf emacs is installed from mports, you can browse info files in its
built-in info mode, which provides a more comfortable reading experience with mouse
support. Launch it with:
emacs -f info
Or from within emacs, press C-h i (Ctrl+h then i).