LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-25-2014, 07:30 PM   #1
StevenXL
Member
 
Registered: Jan 2014
Posts: 81

Rep: Reputation: Disabled
dir_colors


Hi guys,

I am trying to change the colors that 'ls' outputs.

I am using konsole, and it is set to use the "Linux Colors" color scheme since I imagine this is the default.

I added the following to my ~/.bashrc file as directed in info page for dircolors:

d=.dircolors
test -r $d && eval "$(dircolors $d)"


I have a ~/.dir_colors file and I copied the file here:

http://www.cs.fsu.edu/general/.dir_colors.mine

I then did "source ~./bashrc" but the colors are not changing.

I also tried "eval 'dircolors'" but that give me this output:

LS_COLORS='';
export LS_COLORS



What am I doing wrong? Thanks!
 
Old 02-25-2014, 07:43 PM   #2
Isaac Velando
LQ Newbie
 
Registered: Feb 2014
Location: Texas
Distribution: Arch, Ubuntu Server, CentOS
Posts: 29

Rep: Reputation: 21
First, I would specify absolute paths in general. Setting
Code:
d=.dircolors
will make
Code:
dircolors $d
try to execute in the current working directory. In any event, you named your file ~/.dir_colors but it looks like you're trying to use a file called .dircolors - this would cause a problem right there, so try fixing that first. To be specific, for your script I would change it to:
Code:
d=$HOME/.dir_colors
($HOME should resolve the same as ~). For reference, in my .bashrc I write the dircolors line as so:
Code:
eval `dircolors $HOME/.dir_colors`
Hope this helps.
 
Old 02-25-2014, 09:23 PM   #3
StevenXL
Member
 
Registered: Jan 2014
Posts: 81

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Isaac Velando View Post
First, I would specify absolute paths in general. Setting
Code:
d=.dircolors
will make
Code:
dircolors $d
try to execute in the current working directory. In any event, you named your file ~/.dir_colors but it looks like you're trying to use a file called .dircolors - this would cause a problem right there, so try fixing that first. To be specific, for your script I would change it to:
Code:
d=$HOME/.dir_colors
($HOME should resolve the same as ~). For reference, in my .bashrc I write the dircolors line as so:
Code:
eval `dircolors $HOME/.dir_colors`
Hope this helps.
I did replace my ~/.bashrc with this line now:

d=$HOME/.dir_colors

Would I remove the following line from ~/.bashrc then:

test -r $d && eval "$(dircolors $d)"

and replace it with:

eval `dircolors $HOME/.dir_colors`
 
Old 02-25-2014, 09:58 PM   #4
Isaac Velando
LQ Newbie
 
Registered: Feb 2014
Location: Texas
Distribution: Arch, Ubuntu Server, CentOS
Posts: 29

Rep: Reputation: 21
There are two essentially equivalent options:

Code:
d=$HOME/.dir_colors
test -r $d && eval "$(dircolors $d)"
and
Code:
eval `dircolors $HOME/.dir_colors`
should have the same effect as long as ~/.dir_colors exists. The second option just ignores doing any testing to make sure the file is there and readable (test -r) which I don't mind since I always set up the .dir_colors file on my installs.
 
Old 02-25-2014, 11:01 PM   #5
StevenXL
Member
 
Registered: Jan 2014
Posts: 81

Original Poster
Rep: Reputation: Disabled
Question

Quote:
Originally Posted by Isaac Velando View Post
There are two essentially equivalent options:

Code:
d=$HOME/.dir_colors
test -r $d && eval "$(dircolors $d)"
and
Code:
eval `dircolors $HOME/.dir_colors`
should have the same effect as long as ~/.dir_colors exists. The second option just ignores doing any testing to make sure the file is there and readable (test -r) which I don't mind since I always set up the .dir_colors file on my installs.
Thanks Isaac.

It seems to be working in the sense that echo $LS_COLOR gives the following output:

no=00:fi=00:di=01;34:ln=01;36i=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01r=40;31;01:su=37;4 1:sg=30;43:ca=30;41:tw=30;42w=34;42:st=37;44:ex=01;32:*.bat=01;32:*.BAT=01;32:*.btm=01;32:*.BTM=01 ;32:*.cmd=01;32:*.CMD=01;32:*.com=01;32:*.COM=01;32:*.dll=01;32:*.DLL=01;32:*.exe=01;32:*.EXE=01;32: *.7z=01;31:*.ace=01;31:*.ACE=01;31:*.arj=01;31:*.bz2=01;31:*.cpio=01;31:*.deb=01;31:*.dz=01;31:*.gz= 01;31:*.jar=01;31:*.lzh=01;31:*.lzma=01;31:*.rar=01;31:*.RAR=01;31:*.rpm=01;31:*.rz=01;31:*.tar=01;3 1:*.taz=01;31:*.tb2=01;31:*.tbz2=01;31:*.tbz=01;31:*.tgz=01;31:*.tlz=01;31:*.trz=01;31:*.txz=01;31:* .tz=01;31:*.tz2=01;31:*.xz=01;31:*.z=01;31:*.Z=01;31:*.zip=01;31:*.ZIP=01;31:*.zoo=01;31:*.aac=01;35 :*.AAC=01;35:*.anx=01;35:*.asf=01;35:*.ASF=01;35:*.au=01;35:*.axa=01;35:*.axv=01;35:*.avi=01;35:*.AV I=01;35:*.bmp=01;35:*.BMP=01;35:*.divx=01;35:*.DIVX=01;35:*.flac=01;35:*.FLAC=01;35:*.gif=01;35:*.GI F=01;35:*.jpg=01;35:*.JPG=01;35:*.jpeg=01;35:*.JPEG=01;35:*.m2a=01;35:*.M2A=01;35:*.m2v=01;35:*.M2V= 01;35:*.m4a=01;35:*.M4A=01;35:*.m4p=01;35:*.M4P=01;35:*.m4v=01;35:*.M4V=01;35:*.mid=01;35:*.midi=01; 35:*.mka=01;35:*.mkv=01;35:*.MKV=01;35:*.mov=01;35:*.MOV=01;35:*.mp3=01;35:*.MP3=01;35:*.mp4=01;35:* .MP4=01;35:*.mp4v=01;35:*.mpc=01;35:*.MPC=01;35:*.mpeg=01;35:*.MPEG=01;35:*.mpg=01;35:*.MPG=01;35:*. nuv=01;35:*.oga=01;35:*.ogv=01;35:*.ogx=01;35:*.ogg=01;35:*.OGG=01;35:*.pbm=01;35:*.pgm=01;35:*.png= 01;35:*.PNG=01;35:*.ppm=01;35:*.qt=01;35:*.ra=01;35:*.RA=01;35:*.ram=01;35:*.RAM=01;35:*.rm=01;35:*. RM=01;35:*.spx=01;35:*.svg=01;35:*.svgz=01;35:*.tga=01;35:*.TGA=01;35:*.tif=01;35:*.TIF=01;35:*.tiff =01;35:*.TIFF=01;35:*.vob=01;35:*.VOB=01;35:*.wav=01;35:*.WAV=01;35:*.wma=01;35:*.WMA=01;35:*.wmv=01 ;35:*.WMV=01;35:*.xbm=01;35:*.xcf=01;35:*.xpm=01;35:*.xspf=01;35:*.xwd=01;35:*.XWD=01;35:*.xvid=01;3 5:


and echo $LS_OPTIONS:

-F -b -T 0 --color=auto

However. The output still looks pretty ugly! LOL. But at least this doesn't seem to be the problem anymore. Maybe I have some unorthodox setting activated in the terminal emulator.
 
  


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
[SOLVED] read my DIR_COLORS file from my local instead of in /etc/DIR_COLORS casualzone Linux - Newbie 4 07-18-2011 08:19 PM
.dir_colors help unixshell101 Linux - Software 2 12-26-2007 05:48 PM
DIR_COLORS messages stealth886 Linux - Software 0 11-06-2007 06:10 PM
$HOME/.dir_colors ignored?? registering Mandriva 2 05-31-2004 05:24 PM
Dir_colors twk Linux - General 1 05-07-2003 01:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:50 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