Help answer threads with 0 replies.
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 12-01-2006, 09:31 AM   #1
LQ Newbie
Registered: Nov 2006
Posts: 5

Rep: Reputation: 0
Changing Bash Colors

I'm looking for an EASY way to change:
- background color
- foreground color
in text mode.

For instance, I start Linux in text mode, I login and I see white text on black screen. What changes should I make to .bashrc to see black text on red screen (for example?)

I'm using:
Red Hat Release 5.0 (Hurricanne)
Kernel 2.0.32
GNU bash, version 1.14.7(1)
Old 12-01-2006, 09:39 AM   #2
Registered: Jul 2005
Location: Brighton, UK
Distribution: Mainly Debian and Mepis, but also Slackware, Arch and Mandriva
Posts: 73

Rep: Reputation: 15

Do you mean changing the prompt and stuff?

I found this article useful:

Hope this helps.

Old 12-01-2006, 09:41 AM   #3
Senior Member
Registered: Mar 2006
Location: India
Distribution: Fedora
Posts: 1,562
Blog Entries: 3

Rep: Reputation: 61
Old 12-01-2006, 09:42 AM   #4
Senior Member
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
Is this the virtual console screen, or are you using a terminal emulator in X?
Old 12-01-2006, 11:44 AM   #5
LQ Newbie
Registered: Nov 2006
Posts: 5

Original Poster
Rep: Reputation: 0
Originally Posted by 1337_penguin

Do you mean changing the prompt and stuff?

I found this article useful:
I tried what they said, but it didn't work:
PS1="\[\e]2;\u@\H \w\a\e[32;1m\]>\[\e[0m\] "
my PS1 became:
\e]2;root@\H /etc/X11/fvwm2\a\e[32;1m>\e[0m

and for:
PS1="\[\e[32;1m\]\u@\H > \[\e[0m\]"
I got:
\e[32;1mroot@\H > \e[0

This, however, does work:
PS1="[\[\033[31;1m\u\[\033[0m@\[\033[34;1m\h\[\033[0m \[\033[34m\w\[\033[0m]>> "

I'm reffering to a terminal that is started from inittab, like this:
1:12345:respawn:/sbin/mingetty tty1. I don't have a X interface at all.

Is there a script that will take background and foreground colors as input and genereate the sequence?

If I change the PS1 background, it doesn't change the tty background, which is what I wanted in the first place.

Last edited by ForumJoiner; 12-01-2006 at 11:49 AM.


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
Changing window colors Ariod Mandriva 3 09-11-2005 05:36 AM
changing prompt colors? microsoft/linux Debian 2 05-29-2005 05:22 PM
changing ls colors jsfour Slackware 7 12-04-2003 01:43 AM
changing the number of colors Robert0380 Linux - General 7 05-22-2003 08:48 AM
changing colors RaheimSG Linux - Newbie 2 09-15-2002 10:47 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:24 AM.

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
Open Source Consulting | Domain Registration