Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm new to bash and unix. I'm trying to create an alias for ls. In my .bash_profile I have the following:

alias ls="ls -lhHG"

This doesn't work at all. If I change it to:

alias la="ls -lhHG"

then everything but G (showing pretty colors) works.

Right now my $Path is

/opt/local/bin:/Users/clang/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

The only other stuff in my .bash_profile is

1 export EDITOR=/usr/bin/vim
2 export PATH=/opt/local/bin:~/bin:$PATH

Again, I'm totally new to this so please go easy on me.

share|improve this question
    
I'm not sure what you mean by 'doesn't work'. what are you seeing, and what do you want to happen. Also, what platform? Linux, OSX? It is significant what flags to pass to ls to 'work' –  Rich Homolka Oct 5 '10 at 23:13
    
By doesn't work I mean when I try to run the command ls it just runs the ls command with no additional options. The platform is OSX. –  clang1234 Oct 6 '10 at 4:09
add comment

1 Answer

up vote 2 down vote accepted

After you edit .bash_profile, make sure you source it into your current environment with:

source ~/.bash_profile

Or:

. .bash_profile

Then, your new modified commands should be available to you.

share|improve this answer
    
Thanks! I'm away from my mac atm but when I get in tomorrow I'll try this first thing –  clang1234 Oct 6 '10 at 4:10
    
That did it. Thanks so much. Now I'm off to learn vim... I have a feeling I'll be back soon –  clang1234 Oct 6 '10 at 14:54
    
@clang : That's why we're here ;) –  Stefan Lasiewski Oct 6 '10 at 17:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.