Dot and dot-dot directories

Most directories contain two special links, . (dot) and .. (dot dot).

. (“dot”)
The current directory.
.. (“dot dot”)
The directory that this directory appears in.

So, for example, you could list the contents of the directory above your current working directory by typing:

ls ..

If your current directory is /home/fred/my_apps/favs, you could list the contents of the root directory by typing:

ls ../../../..

but the absolute path (/) is much shorter, and you don't have to figure out how many “dot dots” you need.

Note: Flash filesystems don't support . and .. entries, but the shell might resolve them before passing the path to the filesystem. You can also set up hard links with these names on a flash filesystem.

A note about cd

In some traditional Unix systems, the cd (change directory) command modifies the pathname given to it if that pathname contains symbolic links. As a result, the pathname of the new current working directory—which you can display with pwd—may differ from the one given to cd.

In QNX Neutrino, however, cd doesn't modify the pathname—aside from collapsing .. references. For example:

cd /home/dan/test/../doc

would result in a current working directory of /home/dan/doc, even if some of the elements in the pathname were symbolic links.