Skip to content

Instantly share code, notes, and snippets.

@tonythell
Forked from bahamas10/termcap.bash
Last active April 18, 2026 11:47
Show Gist options
  • Select an option

  • Save tonythell/c868d4c2d459c05cd1cc1a4f50e7db49 to your computer and use it in GitHub Desktop.

Select an option

Save tonythell/c868d4c2d459c05cd1cc1a4f50e7db49 to your computer and use it in GitHub Desktop.
Colorize Manpages on the Terminal
# annotated by dave eddy (@yousuckatprogramming)
# explained - https://youtu.be/D0sG2fj0G4Y
# borrowed heavily from https://grml.org
# Begin blinking text mode
# I just use bold red here since my terminal has blinking disabled
export LESS_TERMCAP_mb=$'\e[1;31m'
# Begin bold text mode
export LESS_TERMCAP_md=$'\e[1;31m'
# End all special formatting started by mb/md/etc.
export LESS_TERMCAP_me=$'\e[0m'
# End standout mode
export LESS_TERMCAP_se=$'\e[0m'
# Begin standout mode
# search results - bold, yellow foreground, blue background.
export LESS_TERMCAP_so=$'\e[1;33;44m'
# End underline mode
export LESS_TERMCAP_ue=$'\e[0m'
# Begin underline mode
# underline and bold green
export LESS_TERMCAP_us=$'\e[4;1;32m'
# Begin reverse-video mode
export LESS_TERMCAP_mr=$'\e[7m'
# Begin dim/half-bright mode
export LESS_TERMCAP_mh=$'\e[2m'
# Begin subscript mode
# (probably isn't supported)
export LESS_TERMCAP_ZN=$'\e[74m'
# End subscript mode
# (probably isn't supported)
export LESS_TERMCAP_ZV=$'\e[75m'
# Begin superscript mode
# (probably isn't supported)
export LESS_TERMCAP_ZO=$'\e[73m'
# End superscript mode
# (probably isn't supported)
export LESS_TERMCAP_ZW=$'\e[75m'
# Finally wire up `man` to use `less`
# this is usually the default but let's just be sure
export MANPAGER='less'
export LESS_TERMCAP_mb=$'\e[1;31m'
export LESS_TERMCAP_md=$'\e[1;31m'
export LESS_TERMCAP_me=$'\e[0m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_so=$'\e[1;33;44m'
export LESS_TERMCAP_ue=$'\e[0m'
export LESS_TERMCAP_us=$'\e[4;1;32m'
export LESS_TERMCAP_mr=$'\e[7m'
export LESS_TERMCAP_mh=$'\e[2m'
export LESS_TERMCAP_ZN=$'\e[74m'
export LESS_TERMCAP_ZV=$'\e[75m'
export LESS_TERMCAP_ZO=$'\e[73m'
export LESS_TERMCAP_ZW=$'\e[75m'
export MANPAGER='less'
export LESS_TERMCAP_mb=$(tput bold; tput setaf 1)
export LESS_TERMCAP_md=$(tput bold; tput setaf 1)
export LESS_TERMCAP_me=$(tput sgr0)
export LESS_TERMCAP_se=$(tput sgr0)
export LESS_TERMCAP_so=$(tput bold; tput setaf 3; tput setab 4)
export LESS_TERMCAP_ue=$(tput sgr0)
export LESS_TERMCAP_us=$(tput smul; tput bold; tput setaf 2)
export LESS_TERMCAP_mr=$(tput rev)
export LESS_TERMCAP_mh=$(tput dim)
export LESS_TERMCAP_ZN=$(tput ssubm)
export LESS_TERMCAP_ZV=$(tput rsubm)
export LESS_TERMCAP_ZO=$(tput ssupm)
export LESS_TERMCAP_ZW=$(tput rsupm)
export MANPAGER='less'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment