I am receiving an error from an application I am running.

The error looks like this:

john@john-replacement:~/Desktop/yarbu-1.4.8/bin$ sudo yarbu-engine --VERBOSE
/usr/local/bin/yarbu-engine: line 996: cd: /usr/local/bin/../../etc/yarbu/conf/default: No such file or directory

What do the dots mean in /usr/local/bin/../../etc/ ?


The ../ is notation for "the parent directory" so, in the case you presented:


The system will resolve that as:


It's the same as if you were in the directory /usr/local/bin and you then typed cd .. twice, you would now be in the /usr directory.

You can verify this yourself:

$ cd /usr/local/bin
$ pwd
$ cd /usr/local/bin/../../../
$ pwd
| improve this answer | |
  • 1
    It's not the same as cd .., which sanitizes the path using realpath. If one of the path components of /usr/local/bin is a symbolic link which points somewhere else, then realpath sanitization will not point to the same directory. e.g. if /usr/local is a synlink to /opt/unspecified, /usr/local/bin/../../etc/yarbu/conf/default is resolved as /opt/etc/yarbu/conf/default, but realpath sanitizes it as /usr/etc/yarbu/conf/default. Just nitpicking here. In contrast, ls ../../etc/yarbu/conf/default while in /usr/local/bin works. – BatchyX Dec 27 '12 at 21:16
  • Good point @BatchyX it's not exactly the same... I'll update my answer to reflect that. – gabe. Jan 8 '13 at 22:21

In addition to gabe's answer, which is nice:

The unix command readlink will always return the real path of a file or directory: readlink -f /usr/local/bin/../../etc/ will return /usr/etc/.

The command also resolves symbolic links. For example on my system, readlink -f /usr/bin/java returns /usr/lib/jvm/jdk-7.15-oracle-x64/jre/bin/java. Both use cases are very helpful for scripts.

Btw: .. (and also . which refers to the directory where you are) are not unix specific. The same will also work under at least all dos/windows, mac, linux/unix/bsd based operating systems.

| improve this answer | |

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.