LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 01-17-2007, 07:30 AM   #1
datasink
Member
 
Registered: Nov 2005
Distribution: Ubuntu
Posts: 46

Rep: Reputation: 17
controlling terminal colors


In a terminal window there are various colors for different file types. No matter which scheme I select, there is always one color that doesn't sufficiently contrast with the background color when I do an ls.

I would either like to specify which color each file type uses or simply turn off the use of colors to represent file types. Can I simply make all filenames show up as black on a white background?
 
Old 01-17-2007, 08:22 AM   #2
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
Depending on the distro you use, this may or may not be applicable. On my system there is a Bash startup file called /etc/profile.d/50-dircolors.sh. The contents of this script, with comments added for this post, are
Code:
#Color codes are output only if standard output is connected to a terminal.  Other options are --color=none or --color=always.
alias ls='ls -l --color=auto'

#Look for color definition file in user's $HOME directory.
#If there isn't one there, use the system-wide file.
if [ -f "$HOME/.dircolors" ]; then
  eval `dircolors -b "$HOME/.dircolors"`
else
  if [ -f "/etc/dircolors" ]; then
    eval `dircolors -b "/etc/dircolors"`
  fi
fi
You could add these lines to your $HOME/.bashrc file as well. There is, then, a file called /etc/dircolors created by
Code:
dircolors -p /etc/dircolors
This file is then used to define the colors used in Bash (or terminal emulator). I can edit /etc/profile to set the colors as I see fit.

For the simple black on white scheme, put this in your .bashrc
Code:
alias ls='ls --color=none'
 
Old 01-17-2007, 09:08 AM   #3
datasink
Member
 
Registered: Nov 2005
Distribution: Ubuntu
Posts: 46

Original Poster
Rep: Reputation: 17
Hey, thanks for the valuable explanation. I can't believe everyone doesn't have the same problem I am having. I have seen this both with debian and now with ubuntu (which, of course, is a derivative of debian). It seems like debian needs to be little smarter about matching dircolors with backgrounds.

I'll play with setting up the right colors and backgrounds.

Thanks.
 
  


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
colors in terminal cad Linux - General 1 01-03-2007 12:27 AM
Terminal Colors carlosinfl Linux - General 2 08-29-2006 02:52 PM
Terminal Colors chakkerz Linux - General 2 11-22-2004 09:01 PM
Terminal Colors dhrivnak Slackware 2 10-26-2003 03:59 PM
terminal colors invert gkhattak Linux - Newbie 0 08-29-2002 09:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 12:13 PM.

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