Adding shell colors for headless system

Some unix distributions have fancy shell coloring turned on by default, but for some others, it is a bit more spartian. Below are the few things I setup to add a bit of colors to the systems I access through SSH only.

File type highlighting in shell

By default, this works fine for ls, so I don’t have to do anything.

Colorful shell prompt

This is what I use in the ~/.bashrc file

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u\[\033[00m\]@\[\033[01;34m\]\h\[\033[00m\]:\[\033[01;3    4m\]\w\[\033[00m\]\$ '

For user root (yes, I do sometimes log in as root… my lazy bad), this is what I have to remind me that I should be careful with the shell (red highlight):

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;41m\]\u\[\033[00m\]@\[\033[01;34m\]\h\[\033[00m\]:\[\033[01;    34m\]\w\[\033[00m\]\$ '

Syntax highlighting in VI

I install VIM:

sudo apt-get install vim

Then I create this as the ~/.vimrc file

syntax on
set number
set expandtab
set tabstop=4
set list
set backup

Leave a Reply