I Occupy Space

Stuff.

Turn The Root Shell Prompt Red in Linux

leave a comment »

Linux newbs are usually scared of the terminal, it’s commands are nonsensical to them, and they’re afraid of doing something wrong, especially if they have to work as the root user. Some of them might not even be sure if they’re in the root account or not, which is why this hack is so useful. By adding two lines of code to our /root/.bashrc file, you can easily distinguish which account you’re using. When you’re working as root, the prompt will turn red, and when you’re not, it turns green:

redroot
Just add these two lines to the end of the ~/.bashrc file:

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

And:

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

[via Lifehacker]

Advertisement

Written by giggens

April 3, 2009 at 12:16 am

Posted in linux, ubuntu

Tagged with , , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.