What is a dot only named folder?
Every directory contains a .
and a ..
entry.
.
means the directory itself. It is called the current directory.
..
means the directory's parent directory, that is, the directory that contains it.
There is one directory that is not contained by any other directory: /
. So /
is special--like all other directories, it contains a ..
entry, but its ..
entry is itself. So for /
, and only for /
, ..
and .
are equivalent.
These directory entries are handy for a variety of purposes. For example, you can change directory to the parent of the directory you're currently in with the command cd ..
.
You may have seen .
in the context of running programs or scripts. In a Unix-style shell, when you run a command by name, the shell doesn't automatically try to run a program by the name in the current directory. (This is surprising to some users coming from Windows, where traditionally that would happen.) The main reason for this is security--if someone creates a program in their directory that has the same name as some system administration tool, and you run that tool while in their directory, they could have just tricked you into running their program.
So, to run a program that is not in your PATH
, you must call it by some name that has a /
in it. To run a program in the current directory, you can use ./program
. (You cannot use /program
, because that is an absolute path and means "the file called program
in the root directory, /
.")