I'm on a system running OS X 10.8.5.

I recently tried to alias ls to ls -G -la command. I opened up ~/.zshrc, put in the alias, relaunched the terminal, but the change didn't take effect. Upon performing which ls, I found out that it's already being aliased to ls -G.

This isn't behaviour I ever set up. Is there any way to find out where this alias is being set?


You tagged the question with oh-my-zsh, but did not mention it in the question.

I suspect that oh-my-zsh is creating its own ls alias. If this happens after you define your alias, then it will override yours.

You should probably uncomment DISABLE_LS_COLORS="true" in your .zshrc, or put your alias after the line that does source $ZSH/oh-my-zsh.sh.


Create a file called custom.zsh in ~/.oh-my-zsh/custom/ and put your aliases in this file. These are loaded last in "oh-my-zsh".

  • you mean "in oh my zsh" folder? thx – lese Dec 15 '15 at 9:44

It is probably in the global system .zshrc or equivalent. You should be able to put:

unalias ls
alias ls='ls -G -la'

That will delete the original alias and then create your alias

  • Just tried that. I get no such hash table element: ls – Jules Oct 15 '13 at 3:44
  • @atleastthreecharacters So then ls isn't aliased. What syntax are you using to define your alias? – kurtm Oct 15 '13 at 3:59
  • I'm using alias shortcut="full-command-name". But I know it's aliased, not just because of the reason I stated in my original question, but also because ls actually does display colour-coded results. – Jules Oct 15 '13 at 4:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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