Visit the LQ Articles and Editorials section
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-24-2005, 09:24 AM   #1
LQ Newbie
Registered: Apr 2004
Location: Washington, DC
Distribution: RedHat Linux Professional Workstation
Posts: 4

Rep: Reputation: 0
help! bash command prompt font/color change

can anyone please help me? i'm a newbie trying to figure out linux files and bold or colored command prompts would stand out a lot! my current command prompt is
PS1=' \h \u \w \#> ' .
how can i show the prompt in BOLD or in a different COLOR? thank you for a fast reply!
richard in washington, dc
Old 04-24-2005, 10:12 AM   #2
Senior Member
Registered: Jan 2004
Location: Montpellier (France)
Distribution: Gentoo
Posts: 1,014

Rep: Reputation: 36

see the bash prompt Howto for a complete explanation
Old 04-24-2005, 10:16 AM   #3
Registered: Oct 2003
Location: Heidelberg, Germany
Distribution: Slackware 11.0; Kubuntu 6.06; OpenBSD 4.0; OS X 10.4.10
Posts: 345

Rep: Reputation: 30
You can put colors into your bash prompt using ANSI escape sequences. How to do it is described pretty clearly in the Bash-Prompt-HOWTO which is available at or, depending on your distribution, in /usr/packages/doc/.

Basically, the sequence for your bash prompt in blue looks like this:

PS1="\[\033[1;34m\]\[\h \u \w \]#>\[\033[0m\] "

I think I got that right. Try it and see how it works for you. You can just start up an xterm and paste that in at the command line. The prompt should change immediately. It will go away when you exit the xterm.
Old 04-24-2005, 12:34 PM   #4
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,845

Rep: Reputation: 342Reputation: 342Reputation: 342Reputation: 342
Put this in your .bashrc (or edit to suit your needs first). If you are logged in as user, the prompt is blue. If you su to root, the prompt changes to red. The prompt also shows the full path to the directory you are currently in.

# bash-specific settings
if [ "$UID" -eq "$ROOT_UID" ]
PS1="\[\033[31;1m\]\u \d] \\$\w\n \[\033[0m\]"
PS1="\[\033[34;1m\]\u \d] \\$\w\n \[\033[0m\]"


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Change font color xterm aeruzcar Linux - Software 3 01-04-2012 05:48 PM
Command Prompt Color init_linux Linux - General 2 09-08-2005 03:20 AM
change the font color Drunkalot Linux - General 2 08-09-2005 11:37 PM
change the console font color minike Slackware 3 08-30-2004 06:11 PM
change font NOT in X centr0 Slackware 4 05-01-2003 04:29 AM

All times are GMT -5. The time now is 10:19 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration