What is a man page, and what are the Unix, Linux, and FreeBSD manual sections?

Historically, when unix was brought into life, and in order to explain its capabilities and features, a user manual was created.

This manual was divided into sections, each of which explained a specific topic, such as user commands, function calls, system calls, by providing individual pages, the man pages, which explain for example, a user command, a function, a device file, and the like.

debian:/usr/share/man$ ls
cs es fr.ISO8859-1 hu ja man2 man5 man8 pt sl tr
da fi fr.UTF-8 id ko man3 man6 nl pt_BR sr zh_CN
de fr hr it man1 man4 man7 pl ru sv zh_TW
# Electronically, the manual is located 
# under the /usr/share/man folder.
# The manual contains sections, which are 
# numbered from 1 till 9 : man1 man2 man3...
# They are in English .


debian:/usr/share/man/fr$ ls
man1 man5 man7 man8
# It also contains sections in french 
# under the fr folder, and in Italian 
# under the it folder, and in other
# languages.
# These sections are also numbered from 
# 1 to 9, man1 man2 ..


debian:/usr/share/man/man1$ ls
..
ls.1.gz
chgrp.1.gz 
chmod.1.gz
..
# A manual is formed of sections, so 
# for example, the man1 folder, 
# represents section 1 of the manual. 
# A manual section contains
# man pages, which are compressed.

The manual sections

The sections of the manual are numbered from 1 to 9.

Section 1 contains documentation related to user commands, such as ls, or mv

debian:~$ man 1 ls
# man will display the content 
# of a manual page. 
# In this case we are telling man 
# to display documentation for the 
# ls command, in section 1 of the 
# manual.
# Typically the name of the manual 
# page, is the same as the name of the
# command, or system call... that it 
# provides documentation for.

Section 2 contains documentation related to system calls. So if we want to make a call to the kernel, for example to create or to kill a process, or to open or change the mode of a file, or to get random bytes, we can find documentation about the functions, that we can use this in this section .

debian:~$ man 2 shutdown 
# man will display the manual
# page of the shutdown function,
# in section 2 of the manual.

debian:~$ man shutdown
# if the section number was not
# provided for the man command,
# then man will display the manual
# page, for the shutdown command,
# in section 8 of the manual. 

Section 3 contains documentation related to library functions, for example functions in the C standard library.

debian:~$ man 3 printf
# Display the man page of the 
# printf function, printf is
# declared in the stdio.h header,
# which is part of the c standard 
# library. 

Section 4 contains documentation about files, which act as a device interface. These special files, are also known as device files, and are located under the /dev folder.

debian:~$ man 4 random
# open the random manual page,
# located under the section
# 4 of the manual.
# This  page contains  
# documentation, about the 
# /dev/random , pseudo device.

Section 5 contains documentation about file format, and conventions, as in documentation about the file format of /etc/manpath.config . Additionally under this section, documentation about various filesystems, such as ext4 or proc… can be found.

debian:~$ man 5 hosts
# The hosts 5 man page, describes
# the /etc/hosts file format.

Section 6 contains documentation, about games available on the system.

Section 7 contains documentation, about miscellaneous stuff, such as:

  • character sets, for example, the ASCII and Unicode character sets.
  • standards , such as the file system hierarchy standard.
  • macro packages, such as the groff macro package, used for outputting the manual pages.
  • protocols, such as the ipv6 protocol.

It also provides overviews, about various topics, such as the various interfaces for obtaining randomness.

debian:~$ man 7 ascii
# output the man page, of 
# the ascii character set,
# found under section 7.

Section 8 contains documentation, about system administration commands, as in commands related to mounting a filesystem, or to routing, or to managing users…

debian:~$ man 8 mount
# Output the man page of 
# the mount command, found 
# under section 8 of 
# the manual. 

Section 9 is not standard, and is not found in all distributions, it contains documentation about kernel functions, and how the kernel internally works.

There are also sections of the manual which are deprecated, as such they are not used anymore.

  • Section n (Deprecated): Documentation for what is newly installed, is first placed in this section, before being moved to its appropriate location.
  • Section l (Deprecated): documentation which is local to this system, is placed here.
  • Section o (Deprecated): documentation which is old, is placed here.

Additionally, there is what is called section extensions. Sections extensions exist, because sometimes there are some manual pages, with the same name, and they belong to the same section, as such they are placed in a section extension. The section extension is the manual section name, followed by the extension.

  • Section 3posix: section of the manual, related to posix library functions.
  • Section 3pm: section of the manual, related to library functions, which are related to perl modules.
  • Section 3perl: section of the manual, related to library functions, which are related to perl.
  • Section 3am: section of the manual, related to library functions, which are related to awk modules.