Linux: How to customize your terminal

In this short tutorial, I’ll tell you how to modify your bash into something more useful for you.

You can customize your terminal’s colors, background, title, cursor and bash prompt.

To customize your colors:

1) Open the Terminal Menu

2) Navigate to Edit Profiles

3 ) Create a new profile and Edit it

4) After you’ve done editing it, make sure you set Profile used when launching a new terminal to your new profile’s name.

To customize your bash prompt (PS1):

We’ll use the great

1) Open bashgenerator and make your dream PS1

2) After you’re done, open the terminal’s settings. Write sudo gedit ~/.bashrc

3) First of all save your current .bashrc to .bashrc_backup , just in case things don’t work out from the first time.

4) Find PS1 in .bashrc and replace it with Your generated .bashrc PS1 and additional functions from bashgenerator.

5) Close any terminal instances

6) Open a new terminal and rejoice.

If things didn’t work from the first time, replace the non-working .bashrc with the .bashrc_backup and try again!

If you just want ready to use, awesome PS1, and the colors are Tango:
Screenshot from 2014-03-13 13:20:54

PS1="\[\e[00;33m\]\u\[\e[0m\]\[\e[00;37m\] \[\e[0m\]\[\e[00;31m\]@\[\e[0m\]\[\e[00;37m\] \[\e[0m\]\[\e[00;33m\]\w\[\e[0m\]\[\e[00;37m\]\n\[\e[0m\]\[\e[00;31m\]>\[\e[0m\]"

Extra round: Show current git branch

Add an extra function in the .bashrc file
# show git branch
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'

And somewhere in the PS1 add the following: \\$(parse_git_branch)

Complete PS1:
PS1="\[\e[00;33m\]\u\[\e[0m\]\[\e[00;37m\] \[\e[0m\]\[\e[00;31m\]@\[\e[0m\]\[\e[00;37m\] \[\e[0m\]\[\e[00;33m\]\w\[\e[0m\]\[\e[00;37m\] \$(parse_git_branch) \n\[\e[0m\]\[\e[00;31m\]>\[\e[0m\]"


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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