Colored prompts in bash

To get colored prompts in bash shells, all we have to do is to change the PS1 line in each user’s .basrc file:
nano ~$USER/.bashrc

If necessary uncomment the line:
force_color_prompt=yes

I have a green prompt for the main user:
PS1='${debian_chroot:+($debian_chroot)}\[33[01;32m\]\u@\h\[33[00m\]:\[33[01;34m\]\w\[33[00m\]\$ '
which is the default if you enable color prompts.

a red one for root:
PS1='${debian_chroot:+($debian_chroot)}\[33[01;31m\]\u@\h\[33[00m\]:\[33[01;34m\]\w\[33[00m\]\$ '

and a purple one for my NAS:
PS1='\[33[01;35m\]\h\[33[00m\]:\w\$ '

 

Advertisements