Quick note before you start
If you mean the Unix/linux “man” manual viewer, this guide walks you through installing, configuring, and troubleshooting it so man pages display the way you want. The steps cover common Linux distributions and a few useful environment variables and tips.
What “man” does and why configure it
The man command displays system manual pages for programs, libraries and system calls. Configuring it helps you:
- See manuals in the pager you prefer (less, more, etc.).
- Add custom manual directories so third-party tools show up.
- Keep the man database current for fast searches (what/apropos).
- Improve readability with color and wrapping options.
Step-by-step configuration
1) Check whether man is installed
Run a simple check first:
man --version || man --help || man lsIf you see version/help output or the manual for a command, man is present. If the command is missing, install it next.
2) Install man (if needed)
On most Linux systems use the package manager:
- Debian/ubuntu:
sudo apt update
sudo apt install man-db manpages manpages-dev - Fedora/RHEL/centos:
sudo dnf install man-db man-pages
# or on older systems:
sudo yum install man-db man-pages - Arch Linux:
sudo pacman -S man-db man-pages - macOS typically includes man by default.
3) Build or update the man database
Many distributions use mandb to index manual pages. Run it after installing new packages or adding manual files:
sudo mandbIf your distro lacks mandb, look for makewhatis or whatis -u (older systems).
4) Add and register custom manual directories
When you install software locally, place man files in the standard layout and update the database:
# example: install a local man page
sudo install -m 644 mytool.1 /usr/local/share/man/man1/
sudo mandbAvoid overwriting MANPATH environment variable unless you need to. When necessary, add directories in these ways:
- System-wide: edit /etc/manpath.config (or a distro-specific manpath file) to include additional paths.
- User-specific: add a path to MANPATH in your shell rc:
export MANPATH="/usr/local/share/man:/usr/share/man:${MANPATH:-}"Note: setting MANPATH manually can disable automatic path discovery; prefer adding files under /usr/local/share/man if possible.
5) Choose and configure the pager
man by default uses the pager from PAGER or MANPAGER. A common, friendly choice is less with raw control character support:
export MANPAGER="less -R"
export PAGER="less -R"Add these lines to ~/.bashrc or ~/.profile. You can also invoke man with a pager for a single command:
man -P "less -R" tar6) Improve appearance and color
To keep bold and underlined text visible when using less, set terminal escape sequences. Put these in your shell rc file:
export LESS_TERMCAP_mb=$'e[1;31m' # begin blink/bold
export LESS_TERMCAP_md=$'e[1;31m' # begin bold
export LESS_TERMCAP_me=$'e[0m' # end mode
export LESS_TERMCAP_se=$'e[0m'
export LESS_TERMCAP_so=$'e[1;44;33m'
export LESS_TERMCAP_ue=$'e[0m'
export LESS_TERMCAP_us=$'e[1;32m'These environment variables make headings, bold and underlines stand out. Keep MANPAGER=”less -R” so color control sequences pass through.
7) Control formatting options
To adjust how man calls the typesetter you can use MANROFFOPT and MANWIDTH. For example:
export MANROFFOPT="-c" # preserve hyphenation/formatting in some setups
export MANWIDTH=80Behavior varies between implementations, so try options on a sample page. Alternatively use man flags like -T and pass groff options directly when necessary.
8) Localization and language
man shows pages in the language set by your locales. Example:
export LANG=fr_FR.UTF-8
# or
export LC_MESSAGES=en_US.UTF-8Change these to see manuals in the desired language if translated pages exist.
9) Troubleshooting common issues
- No manual for a command: confirm package with man pages is installed; run sudo mandb; check MANPATH.
- Poor formatting or weird characters: ensure MANPAGER uses less -R and your terminal supports UTF-8; check MANWIDTH or MANROFFOPT.
- Custom man pages not found: place them in the correct manX directory (man1, man8, etc.), run sudo mandb, and check permissions (world-readable).
- Accidental MANPATH override: remove MANPATH from your shell rc and rely on system config or add only the extra path with care.
Quick example: get a clean setup on Debian/Ubuntu
# install man tools
sudo apt update
sudo apt install man-db manpages
# set a pleasant pager and colors in ~/.bashrc
echo 'export MANPAGER="less -R"' >> ~/.bashrc
echo 'export PAGER="less -R"' >> ~/.bashrc
# (add LESS_TERMCAP_* lines from above to ~/.bashrc as desired)
# add a local man page and refresh the index
sudo install -m 644 mytool.1 /usr/local/share/man/man1/
sudo mandbFinal summary
Configuring man is mostly about making sure the program and its index are installed, adding any custom manual directories in the right place, and setting environment variables for the pager, colors, and locale. Use sudo mandb after adding pages, prefer /usr/local/share/man for local installs, and set MANPAGER=”less -R” and a few LESS_TERMCAP_* variables to improve readability. If something doesn’t show up, check MANPATH, file permissions and rerun the man database update.
