How to I add color to "ls" or "vi"?

How to I add color to "ls" or "vi"?

For "ls" you need the GNU "fileutils" version of ls.
Obtain the binary from
http://www.sunfreeware.com/
or compile it yourself from source from
http://www.gnu.org/
I only use "ls" out of all the utilities in the package and
install it in /usr/local/bin/ls.
I then use this alias:
alias ls='/usr/local/bin/ls --color=auto'
(remove the "=" for *csh shells).


For vi, I use vim (or gvim for X Windows).
It is also available from
http://www.sunfreeware.com/
or directly from
http://www.vim.org/.
You may need to add "syntax on" in your $HOME/.vimrc file
to enable syntax coloring.


If color output still doesn't appear, for either of these,
make sure your terminal emulator supports color (e.g., dtterm)
and that your $TERM is set correctly.
To verify you can display color, copy, paste, and execute this line
in your shell prompt (you should see the letters
"blue" highlighted
in blue):

/bin/echo '\033[0m\033[01;34mblue\033[0m'




Home
FAQ