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.

How do I create an alias c that will cd and then immediately ls?

alias c='cd; ls'

Is there some kind of way to insert a special variable that represents the input? Or is that not the way that alias operates at all?

share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted

Correct. Use a function instead.

c() { cd "$1" ; ls ; }
share|improve this answer
1  
OMG - what keywords can I use to Google on more similar stuff like this? –  funk-shun Apr 21 '11 at 6:59
1  
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.