Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to create two different aliases to the same command without repeating myself. How can I do it in bash? For example, I want listlong and longlist to both be aliases to "ls -al".

share|improve this question
up vote 9 down vote accepted
alias {listlong,longlist}="ls -al"

That should do it.

share|improve this answer
alias listlong='ls -al'
alias longlist=listlong

And further changes of the alias listlong reflect on longlist too.

share|improve this answer
I prefer this method because it requires less understanding of bash :-) – Torben Gundtofte-Bruun Sep 7 '10 at 13:32

Here's a variation on cYrus's answer with even less repetition:

alias listlong='ls -al' longlist=listlong

If you want to do something similar but have them be independent:

cmd='ls -al'; alias listlong=$cmd longlist=$cmd

which has similar results to Janne Pikkarainen's answer (which is the least repetitive so far).

share|improve this answer

Your Answer


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.