LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   color-ls not working in Konsole (https://www.linuxquestions.org/questions/slackware-14/color-ls-not-working-in-konsole-498679/)

davidVK 11-04-2006 06:10 PM

color-ls not working in Konsole
 
Using the same /etc/profile I used in slack9,9.1,10.0,10.1 and 10.2 without problem I do not get color-ls working in slackware 11.0. Otherwise installed flawlessly on three different machines.
Is this a slackware problem or KDE 3.5 deficiency?
davidVK

Thank you tobyl.
I had saved profile to profile.orig then imported slackware 10.2 /etc/profile. Returning to profile that came with slackware 11.0 allowed color-ls to work, but I needed aliases and PS1 from before so I added them to the file one at a time. There was a line "alias ls='ls -F'" which dated back to the 9.0
installation and when added killed color-ls. Interestingly, it can be used from the command line without killing the color but the option adds '/', '@' and '*' after filename which ls without option does anyway.
My old profile had the same "# Set up the LS_COLORS . . . " as you mentioned and it works with or without that 'if' clause.
davidVK

tobyl 11-05-2006 08:37 AM

If you upgraded, have you got a profile.new in /etc?
If so, try saving your old profile and renaming the profile.new to profile

I think you can test without restarting your session with
# source /etc/profile

If it is a fresh install, I guess you will need to trawl through /etc/profile, /etc/DIR_COLORS and /etc/profile.d/coreutils-dircolors.sh and figure out what needs to be altered.

my old /etc/profile contained

# Set up the LS_COLORS and LS_OPTIONS environment variables for color ls:
if [ "$SHELL" = "/bin/zsh" ]; then
eval `dircolors -z`
elif [ "$SHELL" = "/bin/ash" ]; then
eval `dircolors -s`
else
eval `dircolors -b`
fi

but I cant remember if I added those lines, or if they were already there, in any case they do not appear in the later version of the file.

files in your home directory will of course override system-wide settings in /etc, so you may also need to visit ~/.bashrc, ~/.bash_profile ~/.dircolors
- but then you would know if you had modified them...

tobyl

dracolich 11-06-2006 06:03 PM

I think konsole and other terminals read the ~/.bashrc file. What I did is replace the .bashrc with a symlink to profile.

xflow7 11-07-2006 07:34 AM

Quote:

Originally Posted by davidVK
Using the same /etc/profile I used in slack9,9.1,10.0,10.1 and 10.2 without problem I do not get color-ls working in slackware 11.0. Otherwise installed flawlessly on three different machines.
Is this a slackware problem or KDE 3.5 deficiency?
davidVK

Thank you tobyl.
I had saved profile to profile.orig then imported slackware 10.2 /etc/profile. Returning to profile that came with slackware 11.0 allowed color-ls to work, but I needed aliases and PS1 from before so I added them to the file one at a time. There was a line "alias ls='ls -F'" which dated back to the 9.0
installation and when added killed color-ls. Interestingly, it can be used from the command line without killing the color but the option adds '/', '@' and '*' after filename which ls without option does anyway.
My old profile had the same "# Set up the LS_COLORS . . . " as you mentioned and it works with or without that 'if' clause.
davidVK

Not sure if you're still fighting with this, but probably the reason that

Code:

alias ls='ls -F'
kills the color when it appears in /etc/profile is because it overwrites the alias that is set up by /etc/profile.d/coreutils-dircolors.sh (which itself is run from /etc/profile; line 73-ish if it's the same as mine).

The alias set up by /etc/profile.d/coreutils-dircolors.sh is set to include the -F and --colors options (among others) through the use of the $LS_OPTIONS environment variable.

When you do ls -F only from the command line, it uses the alias with the $LS_OPTIONS options and just appends -F on the end so it doesn't erase the other options.

Not sure why it worked before with alias ls='ls -F' in /etc/profile other than maybe the order things were done in the scripts. If your alias ls='ls -F' appeared before /etc/profile set up it's own alias, then it would have been overwritten but the default alias includes -F so you wouldn't have noticed.

Hope that helps.

Dave

alienux 11-07-2006 10:18 AM

I actually noticed this to be an issue on any distribution that I'm using KDE 3.5 on. I just created/modified .bashrc and added

Code:

alias ls="ls --color"
to get mine to ls in color on a couple of boxes (one with slack and one with fedora 5).


All times are GMT -5. The time now is 05:35 AM.