The command for displaying the man page for foo
in section 7 is man 7 foo
. The syntax foo(7)
is how references to that man page are usually written.
The section numbers and page names are not the same on every unix flavor.
Commands that you can invoke from the shell generally have a man page by the same name in section 1, but even that has many exceptions, such as:
- Many programs don't come with man pages, especially if they aren't meant to be used from the command line.
- Programs intended to be used by administrators may be in a different section (8 on Linux and BSD, 1m on Solaris).
- Many operating systems don't provide man pages for shell built-ins. Look in the shell's man page instead.
- A few programs with a complex command line or with a lot of documentation split their man page. The other pages generally have a name that starts with a command (but there are exceptions). For example
zsh(1)
only covers a few topics and the rest is in zshbuiltins(1)
, zshzle(1)
and so on; perl
has even more separate pages; openssl(1)
refers you to a separate man page for each subcommand; etc.
C library functions generally have a man page by the same in section 3. C functions that are direct wrappers around system calls, or that were historically so, are in section 2 instead. A few projects ship man pages for C functions in a 3something
section, e.g. 3posix
, 3pcap
, etc. Libraries in a few other languages come with man pages in section 3something
, e.g. 3tcl
for TCL functions. Some languages have e.g. 3perl
for standard Perl modules, 3pm
for third-party Perl modules, 3erl
for Erlang modules, etc.
Section 7, on most unix flavors, contains “miscellaneous” man pages. You can't expect consistent names and content from one flavor to the next.
Linux distributions normally provide the man pages from the Linux man-pages project. Although it's hosted on the Linux kernel web site, that project includes a lot of non-kernel-related documentation, including GNU libc and miscellaneous topics such as regular expression syntax. man7.org
has the same maintainer and shows the Linux man-pages man pages and more.
The Linux man-pages project has a page regex(7)
that documents regular expression syntax. BSD systems have a page with similar content, but called re_format(7)
. The list of pages in section 7 on Linux and FreeBSD is pretty different, that's just one of many differences between two operating systems. On Solaris the set is yet again different, and even the section number is different: 5 is for miscellaneous, while 7 is for devices.
You can run apropos regular expressions
to look for manual pages that discuss regular expressions. That includes a lot of commands and functions that use a regular expression in some way, so you may want to restrict the search to the miscellaneous section. On Linux, you can do that with apropos -s7 regular expressions
. On macOS, neither apropos
nor man -k
seem to support restricting to a section, but you can filter: apropos regular expressions | grep '(7)'
.
Also, both the regex(3)
and grep(1)
man pages, both on Linux and macOS, have a reference to the page in section 7 that documents the regular expression syntax.
man -k regex
. That will give you a lot of pages (potentially including Tcl and other stuff). If you don't seeregex (7)
on that list then you don't have it.regex(7)
is the name of the manpage I've seen there, thoughre_format(7)
also looks to appear as a link to the same manpage. BSDs seem to only havere_format(7)
(e.g. FreeBSD) And macOS is somewhat BSD-ish.