Unix: Overloading Aliases

1

What happens if I have this in my bashrc:

alias ls="ls -l"
alias ls="ls -a"

when I type ls they will both match. Is the last one kept or both?

sixtyfootersdude

Posted 2010-03-08T20:27:14.623

Reputation: 6 399

Answers

6

The second alias command will redefine the alias for "ls". You can double check by running the alias command with no arguments, to see which aliases are defined.

sblair

Posted 2010-03-08T20:27:14.623

Reputation: 12 231

1+1 Right answer. No overloading with the alias command. – Satanicpuppy – 2010-03-08T21:35:46.873

1Or better yet, alias ls will show you what (if anything) ls specifically is aliased too. – Matthew Flaschen – 2010-03-08T22:18:17.130