LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   getting permanent color for ls? (https://www.linuxquestions.org/questions/linux-newbie-8/getting-permanent-color-for-ls-6396/)

JapKraut 09-10-2001 12:34 AM

getting permanent color for ls?
 
Just wondering how I can get ls to always show color without me typing the switch. I tried editing my .bashrc with --color=always and I also tried --color=yes and --color=tty Nothing seems to work.

elconde 09-11-2001 12:23 AM

A simple alias ls 'ls --color=tty' line in the .bashrc file should work. I did that and it works fine. But then I use tcsh instead of bash (I edited .tcshrc instead of .bashrc ). I don't see how that would make any difference.

I hope that's helpful.




-Robert

JapKraut 09-11-2001 03:50 PM

thanks, but...
 
I appreciate the advice, but it doesn't seem to work; I'm not sure where the problem is. I tried adding

alias ls 'ls --color=tty'

as well as

alias ls='ls --color=tty'

to .bashrc; neither of these seem to make any difference.

Any other suggestions?

jharris 09-12-2001 09:47 AM

What is your TERM environment set to? if its something like VT100 - a non-colour terminal then you'll never get colour nomatter what options you use! Run env | grep TERM to list it... Just a thought...

Jamie...

JapKraut 09-12-2001 10:42 AM

well...
 
Typing env |grep TERM
only produces:

TERM=linux

Besides that, my monitor doesn't have any difficulty displaying color with ls. I just can't fathom why the changes to my .bashrc won't take effect.

elconde 09-12-2001 04:10 PM

Put the line alias ls='ls --color=tty' in .bash_profile instead. That worked when I tried using the bash shell.

Is .bashrc even sourced? I don't usually use bash, but I tried it and it wasn't executing anything from .bashrc.

I put an echo blah line in .bashrc and it didn't show up when I logged in. It showed up fine (and the color alias worked) when I typed source .bashrc after loggin in. It also showed up when I typed bash to run another bash shell inside the original.

The .bash_profile file is sourced for sure, though.

linuxcool 09-13-2001 02:18 AM

Just try alias ls='ls --color' or alias ls='ls --color=always' and see what happens.

JapKraut 09-13-2001 09:43 AM

I just sourced .bashrc, and everything works fine! Thanks, elconde.


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