man page通常都是單色的居多,就像你在讀一個txt檔一樣,顏色很單調之外很難抓取重點,看久了難免會頭昏腦脹,這時候如果有個色彩變是的確是會有幫助的唷!就像我之前介紹過的Design清楚明白的Shell環境一般,打造好你的作業環境對工作一定會有幫助,甚至更有效率唷!
主要的步驟我們需要export幾個環境變數
export LESS_TERMCAP_mb=$'\E[1;31m' # begin blinking
export LESS_TERMCAP_md=$'\E[4;32m' # begin bold
export LESS_TERMCAP_me=$'\E[0m' # end mode
export LESS_TERMCAP_so=$'\E[0;31m' # begin standout-mode - info box
export LESS_TERMCAP_se=$'\E[0m' # end standout-mode
export LESS_TERMCAP_us=$'\E[0;33m' # begin underline
export LESS_TERMCAP_ue=$'\E[0m' # end underline
export LESS_TERMCAP_md=$'\E[4;32m' # begin bold
export LESS_TERMCAP_me=$'\E[0m' # end mode
export LESS_TERMCAP_so=$'\E[0;31m' # begin standout-mode - info box
export LESS_TERMCAP_se=$'\E[0m' # end standout-mode
export LESS_TERMCAP_us=$'\E[0;33m' # begin underline
export LESS_TERMCAP_ue=$'\E[0m' # end underline
export過後的效果就會如下圖顯示
我有試著調整每一個變數,然後觀察顏色的變化,最後整理的結果就是還是不要太花俏,能把一些單字會重點凸顯就好,總比一片白底黑字來的好!若您以後也想都如此使用,建議可以把以上的變數加到個人的環境變數設定內,譬如您是使用bash,就加到~/.bashrc囉!
參考文章
http://linuxtidbits.wordpress.com/2009/03/23/less-colors-for-man-pages/
http://huenlil.pixnet.net/blog/post/24675360
http://nelson.pixnet.net/blog/post/24671189