Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I was wondering what the difference between these two were:




It's really difficult to ask this on Google since I didn't know how to explain the . when I didn't even know what to call it. But can someone describe the difference between including the dot and excluding it?

share|improve this question

migrated from Sep 30 '11 at 15:15

This question came from our site for professional programmers interested in conceptual questions about software development.

5 Answers 5

up vote 3 down vote accepted

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.

share|improve this answer
"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." This sounds like the following: The concept of hiding files/directories that start with a dot has actually appeared to hide . ... But later, people realized that being able to hide some files/directories has a value in it and hence, they began to put a dot at the beginning of the files which they want to be hidden. Is that really the case or just a speculation? –  Utku Oct 5 at 14:17
@Utku Actually, it was the other way round, as least at first: the original developer intended to hide only . and .. but made a mistake. It's however possible that he was dissuaded from fixing it because some users found it useful, and the reason why user configuration files start with . is definitely so that they don't clutter the output of ls in the home directory. I think we have a question about this here but I can't find it, it may have been mistagged. –  Gilles Oct 5 at 18:49

To start with ~/somedirectory and ~/.somedirectory are different directories (mkdir wont fail with a File Exists message).

The ls command will not show those entries starting with the ..

If you ls -a, then ls will show both directories.

share|improve this answer
ls -A displays files and directories that start with . but doesn't include the . and .. entries. –  Julian Sep 30 '11 at 15:47

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.

share|improve this answer

The leading "." in a directory or file name causes that directory or file to be hidden when doing a ls command.

share|improve this answer
You can view all files starting with "." with ls -a. –  Sardathrion Sep 30 '11 at 15:06

Like @DaveNay already said, that period will cause the file or directory to be hidden.

For your second implicit question, this is how you search for that in google:

Just type in the search box: linux period before name

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.