LinuxQuestions.org
Visit Jeremy's Blog.
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 01-15-2005, 08:56 PM   #1
tripmix
Member
 
Registered: Nov 2004
Location: Norway
Distribution: Debian mostly
Posts: 107

Rep: Reputation: 16
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?
 
Old 01-15-2005, 09:03 PM   #2
__J
Senior Member
 
Registered: Dec 2004
Distribution: Slackware, ROCK
Posts: 1,973

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

alias ls="ls --color"
 
Old 01-15-2005, 09:22 PM   #3
tripmix
Member
 
Registered: Nov 2004
Location: Norway
Distribution: Debian mostly
Posts: 107

Original Poster
Rep: Reputation: 16
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.
 
Old 01-15-2005, 09:26 PM   #4
__J
Senior Member
 
Registered: Dec 2004
Distribution: Slackware, ROCK
Posts: 1,973

Rep: Reputation: 46
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.
 
Old 01-15-2005, 09:33 PM   #5
tripmix
Member
 
Registered: Nov 2004
Location: Norway
Distribution: Debian mostly
Posts: 107

Original Poster
Rep: Reputation: 16
Someone here must use Debian. Can't go to the Debian forum now, I have to get smarter first . Don't want to look stupid there

Last edited by tripmix; 01-15-2005 at 09:35 PM.
 
Old 01-15-2005, 11:31 PM   #6
hw-tph
Senior Member
 
Registered: Sep 2003
Location: Sweden
Distribution: Debian
Posts: 3,032

Rep: Reputation: 58
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
 
Old 01-16-2005, 01:47 AM   #7
DaHammer
Member
 
Registered: Oct 2003
Location: Planet Earth
Distribution: Slackware, LFS
Posts: 561

Rep: Reputation: 30
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.
 
Old 01-18-2005, 04:49 AM   #8
tripmix
Member
 
Registered: Nov 2004
Location: Norway
Distribution: Debian mostly
Posts: 107

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


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
setting alias in bash, permanently allelopath Linux - General 6 10-24-2008 04:10 AM
alias in bash shell wincrk Linux - General 12 07-20-2004 12:35 PM
Gentoo Linux - Default Bash, where to alias ls --color? tsengj Linux - Distributions 2 02-18-2004 09:34 PM
A bash alias question CodeWarrior Slackware 11 06-03-2003 07:09 PM
bash and alias kleptos Slackware 6 01-23-2003 08:01 AM


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