星期日, 七月 02, 2006

grep、man 顏色設定

既然 ls 顏色設好了, grep、man 當然也要對一些 keyword 來做做顏色區分囉~

grep 對要找的字做顏色標註, 只要用預設參數即可(--color), 所以在 .bashrc 寫個 alias 就好囉, 如下:

alias grep='grep --color'

man 的話需要在 .bashrc 最後面加以下幾行, 就可以輕鬆的看 man page 囉~

  • # For colourful man pages (CLUG-Wiki style)
  • export LESS_TERMCAP_mb=$'\E[01;31m'
  • export LESS_TERMCAP_md=$'\E[01;31m'
  • export LESS_TERMCAP_me=$'\E[0m'
  • export LESS_TERMCAP_se=$'\E[0m'
  • export LESS_TERMCAP_so=$'\E[01;44;33m'
  • export LESS_TERMCAP_ue=$'\E[0m'
  • export LESS_TERMCAP_us=$'\E[01;32m'

有圖有真相~ 見以下圖片:

  1. Screen 1: man ls
  2. Screen 2: grep --color 的結果
  3. Screen 3: grep 沒有 --color 的結果

相關標籤

this is comment icon [回覆]

man...我是用 most 來顯示顏色
http://blog.yam.com/chhuang/archives/1398083.html

又學到一招囉...^^ 謝謝

Comment by (07/02/2006 15:00)

this is comment icon 回 翔 [回覆]

man cp | most 也很棒~ 感謝提供~ m(_ _)m

Comment by Tsung (07/02/2006 15:03)
Add this page to del.icio.us Add this page to Yahoo Taiwan's bookmark Add this page to MyShare

發表迴響

標題

內容 (限制 1000 字)

暱稱

電子郵件

個人網頁


 authimage


PS: 若無法留言, 請先確認是否有打開 JavaScript, 造成您的困擾, 實在萬分對不起 Orz...(如果無法留言, 勞煩可以發信給我好嗎? 謝謝.)
PS2: 若您的留言被誤判, 我都會再自行看過, 不需要一直重覆張貼~