What's so special about directories whose names begin with a dot?
Under unix-like systems, all directories contain two entries, .
and ..
, which stand for the directory itself and its parent respectively. These entries are not interesting most of the time, so ls
hides them, and shell wildcards like *
don't include them. More generally, ls
and wildcards hide all files whose name begins with a .
; this is a simple way to exclude .
and ..
and allow users to hide other files from listings. Other than being excluded from listings, there's nothing special about these files.
Unix stores per-user configuration files in the user's home directory. If all configuration files appeared in file listings, the home directory would be cluttered with files that users don't care about every day. So configuration files always begin with a .
: typically, the configuration file for the application Foo is called something like .foo
or .foorc
. For this reason, user configuration files are often known as dot files.
Directorys starting with a dot .
are considered to be hidden. That means:
~/somedirectory
and~/.somedirectory
are different directories. That is if~/somedirectory
existed and you didmkdir ~/.somedirectory
, you won't fail with aFile Exists
message.The
ls
command will not show those directories starting with the.
The
ls -a
will show both directories
For details on the Unix file system check the standard. Specifically, dot files are used for configuration files in a users directory, and if a program has more than one, it should put them into a dot directory.
This hides the files from the user, unless they want to find them. That way they don't get in the way, and tools don't go messing with them accidentally.