LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   bash ls --color alias? (https://www.linuxquestions.org/questions/linux-newbie-8/bash-ls-color-alias-278265/)

tripmix 01-15-2005 08:56 PM

bash ls --color alias?
 
It works in root but not as normal user. Have tried to change every bashrc file locate could find, I even tried copying /root/.bashrc to /home/tripmix/.bashrc. Anyone know what I'm doing wrong?

__J 01-15-2005 09:03 PM

are you trying to set it by default? you could just do the following in you home .bashrc:

alias ls="ls --color"

tripmix 01-15-2005 09:22 PM

That's what I did and it wont work.

.bashrc in home dir
This is my first try:
eval `dircolors -b`
alias ls='ls --color=auto'
alias dir='ls --color=auto --format=vertical'
alias vdir='ls --color=auto --format=long'

Second try:
export LS_OPTIONS='--color=auto'
eval `dircolors`
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'

Second one is a copy of .bashrc in /root and it works when I log in as root or su.

__J 01-15-2005 09:26 PM

must be something debian specific? thats worked for every distro I've ever used. Did you try asking in the debain forums - probably someone there who knows.

tripmix 01-15-2005 09:33 PM

Someone here must use Debian. Can't go to the Debian forum now, I have to get smarter first :p . Don't want to look stupid there :D

hw-tph 01-15-2005 11:31 PM

You can use the bash command source to apply the settings in your .bashrc to your current bash session - source ~/.bashrc. Try it. If it does work, but your settings aren't applied in new terminals or when logging in through ssh (or equivalent), make sure your ~/.bashrc is parsed every time you log in. Do this by adding this to your ~/.bash_profile:
Code:

if [ -f ~/.bashrc ]
then
    source ~/.bashrc
fi

This will ensure that your settings in .bashrc are applied to all types of logins.


Håkan

DaHammer 01-16-2005 01:47 AM

See what your TERM environment variable is set to. For dircolors to work, you must use a term that supports color. You could just look and see what root's is and use it for your user.

as root:
echo $TERM

as user:
export TERM=whatever

Probably either xterm or xterm-color.

tripmix 01-18-2005 04:49 AM

Thanks a lot hw-tph that did it.
DaHammer: I was only having problems whit normal CLI not a term but thanks anyway.


All times are GMT -5. The time now is 05:17 PM.