LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   controlling terminal colors (https://www.linuxquestions.org/questions/linux-desktop-74/controlling-terminal-colors-520121/)

datasink 01-17-2007 07:30 AM

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?

weibullguy 01-17-2007 08:22 AM

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'

datasink 01-17-2007 09:08 AM

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.


All times are GMT -5. The time now is 02:12 AM.