Spice up your bash prompt

I spend a lot of my time sitting in front of terminals if you have not yet guessed. When dealing with different user accounts across different systems and a plethora of terminals open its nice to have a bit of information about who you are, and where you are. I also like to be able to easily differentiate output from different commands. If your interested read on.

You will want to edit your user .bashrc as well as your /root/.bashrc. For your user append this line

PS1="\n[\u@\h] \w\n$ "

This will give you output like this on your terminal.

[[email protected]] ~/test
$ ls
file  file2

[[email protected]] ~/test

And for /root/.bashrc you will want to append

PS1="\n[\[033[1;31m\]\u\033[0m\]@\033[1;33m\]\h] \w\n$ "

This will give you output like this.

[root@neuron] /home/cmdln/test
# ls
file  file2

[root@neuron] /home/cmdln/test

No Comments

Leave a Reply

Your email is never shared.Required fields are marked *

To submit your comment, click the image below where it asks you to...
Clickcha - The One-Click Captcha