LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 01-09-2009, 06:03 AM   #1
janslinuxq
LQ Newbie
 
Registered: Jan 2009
Posts: 3

Rep: Reputation: 0
Change colors in Bash background and text


How can I change the background to be black and text color to be green or cyan in bash? How can I change the colors so that when I type in "ls" I will see files to be green, and directories to be blue and executables to be red? Then, if I change to superuser, how do I make the colors work for the superuser?
 
Old 01-09-2009, 06:40 AM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,527

Rep: Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898
Quote:
How can I change the colors so that when I type in "ls" I will see files to be green, and directories to be blue and executables to be red
add this to .bashrc
# enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ]; then
eval "`dircolors -b`"
alias ls='ls --color=auto'
#alias dir='ls --color=auto --format=vertical'
#alias vdir='ls --color=auto --format=long'
fi


Also take a look at
http://www.google.com/search?q=bashr...nt=iceweasel-a
 
Old 01-09-2009, 06:44 PM   #3
janslinuxq
LQ Newbie
 
Registered: Jan 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
ls --color=auto
Repo, this worked to give some colors for the "ls" command, but it does not let me to set what color I want. How can I modify it to get any color that I want to have?

Repo, I will take a look at the link to see if I can find something to set the background color and the text color for the Bash program.

[EDIT] Repo, if I make a file for the dircolors then I can make my own colors for the ls command. That solves that part.

Last edited by janslinuxq; 01-09-2009 at 10:45 PM.
 
Old 01-09-2009, 06:49 PM   #4
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,527

Rep: Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898Reputation: 898
Quote:
How can I modify it to get any color that I want to have?
If you use gnome-terminal, you can set it in the profile
right click in the terminal => edit current profile
 
Old 01-09-2009, 06:51 PM   #5
Uncle_Theodore
Member
 
Registered: Dec 2007
Location: Charleston WV, USA
Distribution: Slackware 12.2, Arch Linux Amd64
Posts: 896

Rep: Reputation: 60
Is that what you want?
http://tldp.org/HOWTO/Bash-Prompt-HOWTO/

Also, you can change the colors in the output of ls --color by editing /etc/DIR_COLORS on most distributions.
 
Old 01-09-2009, 10:43 PM   #6
janslinuxq
LQ Newbie
 
Registered: Jan 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Found this old link from 2004 that does not work for me since I do not have xtermset or .Xdefaults. Repo, for the Gnome terminal I did find that I can set a profile and a window pops up that allows me to change any settings bash. Repo, from your links, it looks like it is called a console. I can save the profile and then next time that I open a gnome terminal it will go back to the default profile and I have to then manually reselect the profile that I saved.

Isn't there a way to make these same settings in the bashrc file so that it will work each time I start bash? I could not find out what to put into the bashrc file to set the background color and text color and prompt color. There was a lot of links telling how to set the color of text in the console, but nothing on how to set the profile like you can in the window for the gnome terminal. What file does the gnome terminal make when you create those settings? And, how do I make the settings different for the superuser? With bashrc I can have different settings!

Uncle, that lets me change the bash prompt. I want to change the entire color of the console!

Also found this post.

[EDIT] The gnome terminal profile background color and foreground color is based on the system theme. What file has these settings?

The gnome terminal profile uses a default profile. What file sets this?

Last edited by janslinuxq; 01-09-2009 at 11:23 PM.
 
Old 01-09-2009, 11:46 PM   #7
Uncle_Theodore
Member
 
Registered: Dec 2007
Location: Charleston WV, USA
Distribution: Slackware 12.2, Arch Linux Amd64
Posts: 896

Rep: Reputation: 60
OK, first, let's make it clear. Do you want to change background and foreground colors in a terminal emulator _under X_ (in GUI, like KDE or GNOME), *or* do you want to change background/foreground in bare console, without X?

If former, you can try things like
Quote:
xterm -fg red -bg green
(quite a painful combination, but just to give you the idea )

If the latter, you have two ways of going about it.
First, if you're using framebuffer for the console, you should read this thread. Read it to the end. http://osdir.com/ml/linux.fbdev.user.../msg00008.html

If you don't use the framebuffer, then the prompt how-to is actually the only way you can have different colors.
 
Old 01-10-2009, 08:39 AM   #8
archieval
Member
 
Registered: Apr 2007
Location: Philippines
Distribution: Kubuntu, Ubuntu, CentOS
Posts: 289

Rep: Reputation: 41
the right-click-on-terminal then edit profile settings should work and is set only once, probably you are logging from a different machine?
 
  


Reply


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 colors - XFCE icon text and text background bgryderclock Linux - Software 6 09-19-2014 03:49 AM
Dark gray text on black background or psychedelic colors and 99% CPU in use w1k0 Slackware 17 10-22-2008 03:33 PM
boot colors in kernel ( text font and background) drkstr Linux - Kernel 7 07-27-2006 05:59 PM
Gnome splash screen background colors wont change at bootup dreadknott Linux - Newbie 1 01-21-2006 01:57 PM
how change text (and background) color within the bash shell? Xavius Linux - Newbie 4 03-29-2004 03:21 PM


All times are GMT -5. The time now is 08:56 AM.

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