Web Design

Categorized | cli, System

Tags : , , ,

Change the color of your Linux prompt

You can change the color of your BASH prompt to red with this command:

export PS1=”\e[0;31m[\u@\h \W]\$ \e[m”

To make the change permanent, create a .bash_profile in your home directory (if one isn’t already present):

touch ~/.bash_profile

and paste the line directly into the file. Save and close.
For other colors please see the attached list:

Color Code
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
Light Color Code
Light Black 1;30
Light Blue 1;34
Light Green 1;32
Light Cyan 1;36
Light Red 1;31
Light Purple 1;35
Light Brown 1;33
Light Blue 1;34
Light Green 1;32
Light Cyan 1;36
Light Red 1;31
Light Purple 1;35
Light Brown 1;33

Using 642-892 practice questions and 70-291 test engine, you will guarantee pass your PMI-001 exam on first attempt.

Author Profile

T4L ;

Other posts by

Author's web site



Are you satisfied with this blog?
Why not subscribe our RSS Feed? you will always get the latest post.


5 Comments

  1. 1
  2. Jeff C.

    Why go through all that when you can just click on “Edit” and then “Current Profile” and then “colors”?

    2
  3. T4L

    @Jeff C.: not everyone has the possibility to use an X server. Or wants to. :)

    3
  4. Jeff C.

    Ahhhh….and the light shines thru. lol. I didn’t know that that was why that was there. Learned some thing new today. ;)

    4
  5. aditya

    hey, that was a cool trick, here is my little addition,
    Have a different colored prompt each time you login, just add it to your ~/.bashrc

    #My custom colored prompt logic
    random_number=`od -An -N2 -i /dev/random`
    color_code=`expr $random_number % 7 + 30`
    single=`expr $random_number % 2`
    prompt=”$single”\;”$color_code”
    export PS1=”\e[“$prompt”m[\u@\h \W]\$ \e[m”

    5

1 Trackback(s)

  1. 18 07 2009 : Tips4linux: Kumpulan Tips en Trik Linux » TeknoInfo

Leave A Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>