LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 05-19-2005, 04:13 PM   #1
drumstick
Member
 
Registered: Mar 2005
Location: Istanbul
Distribution: Ubuntu Desktop 6.06, SuSE Linux 9.3 Professional
Posts: 35

Rep: Reputation: 15
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?
 
Old 05-19-2005, 05:20 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
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. :}
 
Old 05-19-2005, 05:48 PM   #3
drumstick
Member
 
Registered: Mar 2005
Location: Istanbul
Distribution: Ubuntu Desktop 6.06, SuSE Linux 9.3 Professional
Posts: 35

Original Poster
Rep: Reputation: 15
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..
 
Old 05-19-2005, 07:18 PM   #4
drumstick
Member
 
Registered: Mar 2005
Location: Istanbul
Distribution: Ubuntu Desktop 6.06, SuSE Linux 9.3 Professional
Posts: 35

Original Poster
Rep: Reputation: 15
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.
 
Old 05-20-2005, 01:03 AM   #5
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 52
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
 
  


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
colorful g++ pttcoco Linux - Distributions 2 05-30-2005 02:20 PM
Unicode file names!! shivasa Linux - General 3 10-16-2003 11:04 PM
can't view file in konsole inTUXicated Linux - Newbie 2 08-06-2003 08:02 AM
KNOPPIX Colorful Console -=bcc=-E-nigma Linux - Software 4 05-01-2003 12:43 PM
question about history file on several konsole? doublefailure Linux - General 1 04-08-2002 04:49 AM


All times are GMT -5. The time now is 04:24 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration