LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Colorful File Names in Konsole (https://www.linuxquestions.org/questions/linux-newbie-8/colorful-file-names-in-konsole-325113/)

drumstick 05-19-2005 03:13 PM

Colorful File Names in Konsole
 
Hi,

I want the file names to be colorful in the Konsole terminal window. Such as while txt files are brown, documents are blue, header files are another colour...etc.

When I type "ls" in the home (~) directory it's just as I want (which I am used to), but when I enter into a directory and type "ls" everything is Black&White.

How can I change it to be the same in other directories?


PS. Which one is correct, "Color" or "Colour"? As far as I remember they are both ok. While Americans say Color, English say Colour. Or vice versa? I cant remember which one is which?

Tinkster 05-19-2005 04:20 PM

I'm not quite sure I follow...

Are you saying that the only directory you get
directory colourisation in is ~, but other directories
on your machine present themselves as b&w?

Or do you mean that you're sshing/telneting into
another machine, and it's all b&w?


Cheers,
Tink


P.S.: You got the spelling things right, Americans
just can't spell proper. :}

drumstick 05-19-2005 04:48 PM

Quote:

Originally posted by Tinkster

Are you saying that the only directory you get
directory colourisation in is ~, but other directories
on your machine present themselves as b&w?


Yes I get colourisation only in "~"
For example if I jump into Desktop folder and type "ls" all file and folder names are B&W.

At school in labs we use RedHat and they show in the way I told. And I got used to them :)


By the way, I use SuSE 9.3..

drumstick 05-19-2005 06:18 PM

Here is the inside of /bash.bashrc

Code:

#
# Colored file listings
#
if test -x /usr/bin/dircolors ; then
    #
    # set up the color-ls environment variables:
    #
    if test -f $HOME/.dir_colors ; then
        eval "`dircolors -b $HOME/.dir_colors`"
    elif test -f /etc/DIR_COLORS ; then
        eval "`dircolors -b /etc/DIR_COLORS`"
    fi
fi

#
# ksh/ash soemtimes do not know
#
test -z "$UID"  &&  UID=`id -ur 2> /dev/null`
test -z "$EUID" && EUID=`id -u  2> /dev/null`
test -z "$USER" && USER=`id -un 2> /dev/null`
test -z "$MAIL" && MAIL=/var/spool/mail/$USER
test -z "$LOGNAME"  && LOGNAME=$USER

#
# ls color option depends on the terminal
# If LS_COLROS is set but empty, the terminal has no colors.
#
if test "${LS_COLORS+empty}" = "${LS_COLORS:+empty}" ; then
    LS_OPTIONS=--color=tty
else
    LS_OPTIONS=--color=none
fi
if test "$UID" = 0 ; then
    LS_OPTIONS="-a -N $LS_OPTIONS -T 0"
else
    LS_OPTIONS="-N $LS_OPTIONS -T 0"
fi


What should I change here?


Also in the comments section of the code it says "Do not edit this code. Instead edit /etc/bash.bashrc.local"

But I couldn't find the file where it supposed to be.

foo_bar_foo 05-20-2005 12:03 AM

it's kind of hard to comment on that script without the whole thing and it's profile brothers and sisters

i can't really argue with the script even though i think that stuff should be in profile and not bashrc but whatever

the behaviour you describe is very weird

i think first try this in your ~/.bashrc

alias ls='ls --color=auto'

if that doesn't work try putting the same command in ~/.bash_profile as well

if that doesn't work try adding this to ~/.bash_profile in adidion to the other things
(check out the file first /etc/dircolors and make sure that's what it is called)
the global script is using a variable i think "DIR_COLORS" ?
Code:

if [ -f "/etc/dircolors" ] ; then
        eval $(dircolors -b /etc/dircolors)
fi



All times are GMT -5. The time now is 03:08 PM.