You need to install a pager called most to display colored man pages in Linux and Unix. It is a paging program that displays one window full at a time, the contents of a file on a terminal. It pauses after each window full and prints on the window status line, including the file name, current line number, and the percentage of the file so far displayed. This page explains how to view colored man pages in Linux, FreeBSD, and macOS or Unix-like systems.
How to view or display color in man pages
We are going to install the most package as follows so that we can see a colorful man page on our terminal:
FreeBSD install most to display colored man pages in Unix
To install the port, enter:
# cd /usr/ports/sysutils/most/
# make install clean
Alternatively, you can add the binary package called most using the the following command:
# pkg_add -r most
Newer version of FreeBSD user should use the pkg command:
# pkg install most
Debian/Ubuntu Linux install most show colorful man pages in Linux
Run the following apt-get command or apt command:
$ sudo apt-get install most
OR
$ sudo apt install most
Sample outputs:
Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: most 0 upgraded, 1 newly installed, 0 to remove and 8 not upgraded. Need to get 44.0 kB of archives. After this operation, 121 kB of additional disk space will be used. Get:1 http://archive.ubuntu.com/ubuntu eoan/universe amd64 most amd64 5.0.0a-4 [44.0 kB] Fetched 44.0 kB in 1s (48.3 kB/s) Selecting previously unselected package most. (Reading database ... 235913 files and directories currently installed.) Preparing to unpack .../most_5.0.0a-4_amd64.deb ... Unpacking most (5.0.0a-4) ... Setting up most (5.0.0a-4) ... Processing triggers for man-db (2.8.7-3) ... Processing triggers for mime-support (3.63ubuntu1) ..
Install most under Fedora / RHEL / SL / CentOS Linux?
First, turn on and install EPEL repo on a CentOS and RHEL 7.x (see how to install EPEL repo on a CentOS 8 and RHEL 8 here). Execute the following yum command to install the most package:
# yum install most
Fedora Linux user should type the following dnf command:
$ sudo dnf install most
Arch Linux install most
Try the pacman command:
sudo pacman -S most
Sample outputs:
pacman -S most resolving dependencies... looking for conflicting packages... Packages (1) most-5.1.0-1 Total Installed Size: 0.11 MiB :: Proceed with installation? [Y/n] y (1/1) checking keys in keyring [###################] 100% (1/1) checking package integrity [###################] 100% (1/1) loading package files [###################] 100% (1/1) checking for file conflicts [###################] 100% (1/1) checking available disk space [###################] 100% :: Processing package changes... (1/1) installing most [###################] 100% :: Running post-transaction hooks... (1/1) Arming ConditionNeedsUpdate...
macOS install most
Open the Terminal application and run the brew command. First, install Homebrew on macOS and then type the following brew command:
brew install most
How to view colored man pages in Linux or Unix
Type the following command to set PAGER bash shell variable, enter:
export PAGER="most" ### OR ### export PAGER="/usr/bin/most -s"
I recommend that you modify and setup environment variable called PAGER in ~/.bashrc file as follows:
echo 'export PAGER="most"' >> ~/.bashrc
A Note About CSH / TCSH Shell Users
CSH / tcsh shell users, type the following command:
## csh / tcsh syntax ## setenv PAGER /usr/local/bin/most
How to view colored man page
Try viewing man page for any command. For example, to view the man page of Linux date command, enter:
$ man date
Fig.: Unix / Linux: Color man pages with most command
most command summary
Like many Unix commands, most have tons of options and keyboard shortcuts. Hence, I am going to summarize the commonly used options:
Quitting: Q Quit MOST. :N,:n Quit this file and view next. (Use UP/DOWN arrow keys to select next file.) Movement: SPACE, D *Scroll down one Screen. U, DELETE *Scroll Up one screen. RETURN, DOWN *Move Down one line. UP *Move Up one line. T Goto Top of File. B Goto Bottom of file. > , TAB Scroll Window rightConclusion
You learned how to view colored man pages in Linux and Unix-like oses using the most command as pager. See most paging home page here.
This entry is 1 of 2 in the Linux / UNIX Colorful Man Pages Tutorial series. Keep reading the rest of the series:
- Display Colored Man Pages in Linux and Unix
- Colored Man Pages With less Command
This entry is 3 of 6 in the Installing and Using Man Pages Tutorial series. Keep reading the rest of the series:
🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.
🐧 10 comments so far... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
On Mac OSX there are some interesting options. I use zsh as my shell and I use homebrew instead of macports for installing stuff like “most”.
If you have homebrew you can open terminal and:
“brew install most”
Then with “most” installed you can pipe man to most:
“man date | most”
I also found out today you can pipe man to preview:
“man -t most | open -f -a /Applications/Preview.app”
This creates a PDF, although it’s not colored.
Thanks for the sharing OS X specific info.
I use Termcap to add color to manpages.
1. Add the following to ~/.LESS_TERMCAP
2. Source this file from .bashrc :
More details at http://unix.stackexchange.com/a/147/4
Great info. I appreciate your comment.
Archlinux has same package , vía pacman
I like most however I’m too used to use J and K to scroll in less.
If there was a way to bind J and K to scroll up/down I’d be sold.
On CENTOS/RED HAT you can change the pager for MAN pages only from “less” to “most”.
Edit the setting for PAGER setting in /etc/man.config
PAGER /usr/bin/less -is
to
PAGER /usr/bin/most -s
Built fine from source on OSX. First download slang from the same site.
./configure, make, sudo make install
I couldn’t get most to build with an uninstalled version of slang
Then the same thing for most
i also use “most” but what i dislike about it is that it does not do search highlight. When searching using “/” it scrolls to the location but the found word is not highlighted … annoying somewhat as you have to read around the page to figure out where exactly it found it.
I’ll try the LESS_TERMCAP tip from Stefan, thanks!
most is a standard part of Fedora without RPMforge, and has been for some time. You can install it with:
yum install most