Archive

Posts Tagged ‘prompt’

Use different color for root terminal on Linux

December 4, 2015 Leave a comment

Looking for a way to distinguish the different terminals i usually have opened, I found this post:

http://lifehacker.com/5195951/use-a-different-color-for-the-root-shell-prompt

It just changes the prompt color, red if you’re root, adding this line at the end of /root/.bashrc:

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

and green for normal users, adding this to your ~/.bashrc

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

and restarting the terminals.

Now it’s easier to know if you’re root or not!

Please, feel free to leave your comments

Advertisements
Categories: linux, ubuntu Tags: ,