2

I have an alias pwd

How can I create another alias that is a synonym for it?

For example I have

alias cd1='cd ~/dir1'

I want a second alias cd01 that points to the same place but I don't want to also have:
alias cd01='cd ~/dir1'
in case /dir1 changes

3

It works in both bash and zsh.

$ alias cd1='cd /'
$ alias cd01=cd1
$ cd01; pwd
/
# now, to change cd1
$ alias cd1='cd /etc'
$ cd01; pwd
/etc
1

It should works. On my systems, I have:

alias ls='ls -F'
alias ll='ls -l'

That means ll is alias to ls -F -l. Have you tried your scenario out?

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.