Playing with Bashrc

Yesterday I decided to slightly alter the default prompt of GNOME terminal from plain white to something more consistent with the overall theme of my desktop.

To achieve that, I had to change the .bashrc files on both my home folder, as well as the root home folder. It is required to change both files independently – either with the same attributes, or totally different – for the prompt to apply changes for the user and the root user.

For my user, I modified the .bashrc file by changing the PS1 line to :

PS1='\u @ \e[0;31m\h\e[m > '

This output shows the user followed by @ the hostname of my PC coloured red.

For the root user, I modified the .bashrc file by changing the respective PS1 to :

PS1='\e[0;31m\h\e[m > '

Which is mostly the same configuration, just the hostname coloured red. The final result is :

terminal

There are a tons of different setups anyone can create, from minimal prompts, to eye candy – news feeds – terminal prompts. The best resource was (once again) Arch’s Wiki page.

The whole procedure took me under 5′ (excluding the hundreds of styling changes I applied), but I never would have thought of changing the terminal prompt if it weren’t for CodeAcademy‘s “Learn the Command Line” course.