Skip to content

Instantly share code, notes, and snippets.

@slugbyte
Created December 21, 2018 05:21
Show Gist options
  • Save slugbyte/88519a52ec718f96e77c225c5fa35ebe to your computer and use it in GitHub Desktop.
Save slugbyte/88519a52ec718f96e77c225c5fa35ebe to your computer and use it in GitHub Desktop.

Enhance your *nix manuals with colors using this bash functoin

To install all you need to do is

  1. Add the following code to your bash config and then source it
  2. Then look at a manual i.e. $ man man
man() {
  env \
    LESS_TERMCAP_mb=$(printf "\e[1;31m") \
    LESS_TERMCAP_md=$(printf "\e[1;31m") \
    LESS_TERMCAP_me=$(printf "\e[0m") \
    LESS_TERMCAP_se=$(printf "\e[0m") \
    LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
    LESS_TERMCAP_ue=$(printf "\e[0m") \
    LESS_TERMCAP_us=$(printf "\e[1;32m") \
      man "$@"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment