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 have an ZSH alias:

alias -g ...='../..'
alias -g ....='../../..'

When I try to cd ..., things work perfectly. I can't, however, use it in a cp command: cp .../file . fails with cp: .../file: No such file or directory.

In addition, trying to use the alias such: cd .../dir fails: cd:cd:10: no such file or directory: .../dir. Doing the same thing using cd ...; cd dir works fine.

From the zsh-lovers page:

Global aliases can be used anywhere in the command line. Example:

$ alias -g C='| wc -l'
$ grep alias ~/.zsh/* C

The ZSH Introduction also says that global aliases are substituted anywhere in the command line.

Why aren't my aliases being used as I thought they should be?

share|improve this question
up vote 2 down vote accepted

Maybe the reason is that the '...' in '.../file' is not space/boundry delimited?
e.g In the zsh-lovers example, 'C' is preceded by a space.

From another SU question I found the following that might help:
nicoulaj / dotfiles : rationalize-dots

share|improve this answer
this is my immediate thought, it's not seeing an alias, it's seeing .../file If you aliased C like then and then did mv myClass ~/src/ and it expanded the alias, that'd be a problem. – Rob Apr 6 '12 at 19:13

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.