Paste the following into .bashrc (from [[http://www.ex-parrot.com/pdw/cdiff.html|Paul Warren]]):
# cdiff: coloured diff format
#
# Paul Warren
# 12/01/2001
# Licensed under the GPL
# colour for added lines (bright yellow)
diffnew=`tput setf 6``tput bold`
# colour for removed lines (bright red)
diffold=`tput setf 4``tput bold`
# colour for unchanged lines (bright black, aka dark grey)
diffsame=`tput setf 0``tput bold`
# reset - original pair, unset all attributes
reset=`tput op``tput sgr0`
alias cdiff="diff --changed-group-format='%<%>' \
--new-group-format='%>' \
--old-group-format='%<' \
--new-line-format='${diffnew}+ %l
$reset' \
--old-line-format='${diffold}- %l
$reset' \
--unchanged-line-format='${diffsame} %l${reset}
' "
I generally hardlink .bash_profile to .bashrc so that all shell-like environments are set up the same way -- this may not be The Right Thing To Do[TM] but it seems to make things work the way you probably expected them to if you don't look too hard (my usual goal). If piping into less, use "less -r" or "less -R". Want to compare MS Word files in colour? Tack on:
# compare word files in colour
function docdiff {
cdiff <(antiword "$1") <(antiword "$2") | less -r
}