A Quick Introduction to Unix/Special Directories
The abbreviated directories . and ..[edit| edit source]
The directories named . and .. are relative names. They are interpreted by the shell in the current context. While this takes a moment or two longer to grasp than ordinary absolute directory names, it is a very useful thing about Unix. In any directory you can type
% ls -a
As you will see, there are two directories listed called (.) and (..). These appear in all Unix directories.
Current directory (.)[edit| edit source]
In Unix . means the current directory, so typing
% cd .
means that you stay where you are.
This may not seem very useful at first, but you will often find it very useful – remember that it is a relative directory name.
Parent directory (..)[edit| edit source]
.. means the parent of the current directory, so typing
% cd ..
will take you up one directory.
Home directory (~)[edit| edit source]
Typing cd alone or cd ~ always returns you to your home directory. This is very useful if you are lost in the file system. Typing cd / takes you to the root.
What do you think
% ls ~/..