Tech Journal Back to Tech Journal

Using ANSI codes in the BASH prompt for root

Since bash support changing of the command prompt, and I use an ANSI terminal (both locally and remote), I figured I might as well make sure the user is fully away of the fact that he is using the root account, by highlighting the username. To do this for root, simple add to /root/.bashrc:

  PS1="[\[\033[1;30m\]\u\033[0;37m@\h \W]$ "
  export PS1

This will make the username (in this case, for root) in dark grey.

Last updated on 2000-08-19 14:00:00 -0700, by Shalom Craimer

Back to Tech Journal