Daily Hack #day49 - bash: Colorized Man Pages
Colorized man pages enhance the readability and visual appeal of the traditional manual pages (man pages) found in Unix-like operating systems. By applying color highlighting to different elements of the man pages, such as headings, options, commands, and code snippets, users can quickly identify important information and navigate through the documentation more efficiently.
Colorized man pages often use different colors to distinguish between various elements, making it easier to differentiate between headings, options, command examples, and other text. For example, headings may be displayed in bold and a different color, while options and commands may be highlighted in a contrasting color to stand out.
By providing visual cues and organization, colorized man pages improve the user experience and help users find the information they need more quickly. They are particularly useful for developers, system administrators, and power users who frequently reference man pages to learn about commands, utilities, and system configurations.
To enable colorized man pages, users can typically configure their terminal emulator or shell environment to support ANSI escape codes for color formatting. Additionally, some distributions may include packages or utilities specifically for enhancing man page display with colorization.
Overall, colorized man pages offer a simple yet effective way to improve the accessibility and usability of documentation in Unix-like systems, enhancing the user experience and facilitating efficient information retrieval.
The man pages are viewed with less, here is a snippet you can use to change the default man pages colour scheme. Just add it to your .bashrc
file and source
it.
#
# L E S S C O L O R S F O R M A N P A G E S
#
# CHANGE FIRST NUMBER PAIR FOR COMMAND AND FLAG COLOR
# currently 0;33 a.k.a. brown, which is dark yellow for me
export LESS_TERMCAP_md=$'\E[0;33;5;74m' # begin bold
# CHANGE FIRST NUMBER PAIR FOR PARAMETER COLOR
# currently 0;36 a.k.a. cyan
export LESS_TERMCAP_us=$'\E[0;36;5;146m' # begin underline
# don't change anything here
export LESS_TERMCAP_mb=$'\E[1;31m' # begin blinking
export LESS_TERMCAP_me=$'\E[0m' # end mode
export LESS_TERMCAP_se=$'\E[0m' # end standout-mode
export LESS_TERMCAP_so=$'\E[38;5;246m' # begin standout-mode - info box
export LESS_TERMCAP_ue=$'\E[0m' # end underline
#########################################
# Colorcodes:
# Black 0;30 Dark Gray 1;30
# Red 0;31 Light Red 1;31
# Green 0;32 Light Green 1;32
# Brown 0;33 Yellow 1;33
# Blue 0;34 Light Blue 1;34
# Purple 0;35 Light Purple 1;35
# Cyan 0;36 Light Cyan 1;36
# Light Gray 0;37 White 1;37
#########################################
Subscribe to my newsletter
Read articles from Cloud Tuned directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by