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?


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.

  • 1
    "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 '15 at 14:17
  • 3
    @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 'SO- stop being evil' Oct 5 '15 at 18:49

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 did mkdir ~/.somedirectory, you won't fail with a File Exists message.

  • The ls command will not show those directories starting with the .

  • The ls -a will show both directories

  • 6
    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.


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


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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