Celeb Glow
general | March 05, 2026

Alias for multiple sequential commands?

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?

1 Answer

Correct. Use a function instead.

c() { cd "$1" ; ls ; }
2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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