Beautifying the Terminal :-)


This has been a post that I always wanted to write,(gimmicky!!)

Its always nice to have the work environment set up well/colorful..Makes me fell like working more..

This is not the case when it comes to Terminals(on solaris) Its always been plain black on white text/bg.The first thing I used to do was to change the settings to a white on black display however got bored by it over time and wanted to make it more appealing..And I changed the prompt to a colorful ‘Green’ with a few more details…

Getting down to it…

The syntax to change your PS1 is

\e[x;ym PS1 \e[m               (looks ……….. ) Not really

  • \e[ : start the color scheme syntax
  • x;y : specify the color in combination
  • PS1 : This will be your system prompt (That by default displays ‘bash#’)
  • \e[m : endthe color scheme syntax

For eg,

If you want to convert the prompt to ‘Green’ like I have then this is how the syntax will look,

\e[0;32PS1\e[m

Here is a list of all the color values.

Black 0;30
Blue 0;34
Green 0;32
Cyan 0;36
Red 0;31
Purple 0;35
Brown 0;33
Blue 0;34
Green 0;32
Cyan 0;36
Red 0;31
Purple 0;35
Brown 0;33

NOTE: This change is not permanent, as soon as the session is ended you will lose it.

To make it permanent,go to ‘.bashrc’ file in the $HOME dir.(Usually if your the root user it will not be present,so create one and add the following lines to it)

export PS1=\e[x;ym PS1 \e[m

save and exit the file.The next time you run ‘bash’ you will see something like this.

Screenshot-1

NOTE 2: If you change the value of ‘x’ to 1 then you get a darker shade of the color you choose. I’ve also changed the PS1 to my liking…

Happy coding!!!

Advertisements

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 )

Google+ photo

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

Connecting to %s