zsh alias being overridden somehow
Solution 1
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
.
Solution 2
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".
Solution 3
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
Related videos on Youtube
Jules
Expert Python programmer with experience working with the Linux network stack, REST APIs, and relational databases (and Postgres in particular). There's some devops experience in there too, but software dev is my preference. Not currently open to new work.
Updated on September 18, 2022Comments
-
Jules over 1 year
I'm on a system running OS X 10.8.5.
I recently tried to alias
ls
tols -G -la
command. I opened up~/.zshrc
, put in the alias, relaunched the terminal, but the change didn't take effect. Upon performingwhich ls
, I found out that it's already being aliased tols -G
.This isn't behaviour I ever set up. Is there any way to find out where this alias is being set?
-
Jules over 10 yearsJust tried that. I get
no such hash table element: ls
-
kurtm over 10 years@atleastthreecharacters So then ls isn't aliased. What syntax are you using to define your alias?
-
Jules over 10 yearsI'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 becausels
actually does display colour-coded results.