In chmod -R 421 .gimp, what does the period mean directly preceding the g in gimp? Is that similar to the * wildcard?


The dot in that situation is part of the filename and has in the Linux/Unix context the meaning that the file or directory is hidden, you cannot see it in the file explorer (Nautilus, which is default on the vanilla Ubuntu), unless you press CTRL+H.

And, if you only use ls in the terminal, you will not see it either unless you use the -a or -A flag with it (i.e. ls -a or ls -A or ls --all or ls --almost-all).

However, the dot (.) has different meanings in different contexts:

  • For example in a path (./file) it describes the current directory you are in, while ../file refers to file in the parent directory.
  • And there is even a command . which sources (runs) bash script files. So . ./file (mind the spacing) would source the script named file in the current directory.
  • and in a REGEX context, the dot means "any character".
| improve this answer | |
  • cp or mv to the current directory might be a good example too – Azor Ahai -- he him Sep 5 '18 at 15:42
  • 6
    I think this answer would be better served by being more explicit: That in this case, the dot doesn't mean anything; it's just part of the filename. Nautilus, as a side note, hides all files whose names start with dots. The rest of the information about how . is used is quite useful, though, and it should definitely stay. – Fund Monica's Lawsuit Sep 5 '18 at 20:49
  • 1
    @NicHartley I disagree. The leading dot is part of the name but it carries meaning of a hidden file, at least by Unix convention. In cases such as ~/.bashrc removing that leading dot would cause file being not sourced by bash. So often that leading dot is meaningful. – Sergiy Kolodyazhnyy Sep 6 '18 at 7:44
  • 2
    The leading dot is meaningful, but only because it's part of the filename... – Ash Sep 6 '18 at 9:17
  • @SergiyKolodyazhnyy Bash expects a file named .bashrc in the user's home directory, not some magical combination of a filesystem flag and the filename bashrc. The fact that it contains a dot is literally completely irrelevant; it just matches with Unix conventions. So, no, the dot doesn't mean anything, in the same way extensions don't. There are conventions in place to use it in certain situations, but the OS gives zero-- er, cares. As the answer is written now, it explains it nicely (albeit compactly): It's a part of the filename; it's given extra meaning by how software treats it. – Fund Monica's Lawsuit Sep 6 '18 at 16:24

.gimp in your example is a filename, the "." is the first character.

The significance of it is a normal ls (ls=list files) won't show files with "." as the first character, it only lists with ls -a (or list files --all)

| improve this answer | |
  • 11
    @αғsнιη A directory is still a file, if we're being pedantic. – NieDzejkob Sep 5 '18 at 19:06

Nothing. It's part of the filename.

You appear to have a directory called .gimp.

Period. (lol)

Any other discussion about it belongs in a question about why people choose certain filenames for things.

| improve this answer | |
  • "...why people choose certain filenames for things" Often people don't choose filenames, but filenames are standard, such as config file/directory filename – Sergiy Kolodyazhnyy Sep 6 '18 at 7:46
  • 2
    Joined and upvoted just for the period joke. – return true Sep 6 '18 at 7:58
  • @SergiyKolodyazhnyy Somebody still came up with those :P – Lightness Races in Orbit Sep 6 '18 at 10:46
  • @LightnessRacesinOrbit Lol, OK, fair enough, I can agree with that. As a developer, one can choose what filenames to use. Some of my indicators use leading dot for config files in user's home directory, others - do not for files in ~/.config. But that choice also carries meaning and adheres to standards. A file ~/.config/.mything would be unconventional and confusing to users and be a sign of bad practice to other developers. – Sergiy Kolodyazhnyy Sep 6 '18 at 12:42
  • @SergiyKolodyazhnyy Yep I'm just being deliberately difficult about it to hammer home the point that . has no special meaning to the shell, contrary to the premise of the question – Lightness Races in Orbit Sep 6 '18 at 12:43

The leading dot in file or directory names doesn't carry any particular significance, as far as Linux itself is concerned. However, certain utilities (such as ls or Nautilus file manager) consider such filenames as "hidden", that is they ignore them in their output, and will only show them if you provide a specific option.

In reality, this originated with what technically can be considered a bug. Rob Pike, one of the original people who worked on UNIX team recounts (source):

Long ago, as the design of the Unix file system was being worked out, the entries . and .. appeared, to make navigation easier. I'm not sure but I believe .. went in during the Version 2 rewrite, when the file system became hierarchical (it had a very different structure early on). When one typed ls, however, these files appeared, so either Ken or Dennis added a simple test to the program. It was in assembler then, but the code in question was equivalent to something like this:

    if (name[0] == '.') continue;

This statement was a little shorter than what it should have been, which is

   if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0) continue;

but hey, it was easy.

Two things resulted.

First, a bad precedent was set. A lot of other lazy programmers introduced bugs by making the same simplification. Actual files beginning with periods are often skipped when they should be counted.

Second, and much worse, the idea of a "hidden" or "dot" file was created. As a consequence, more lazy programmers started dropping files into everyone's home directory. I don't have all that much stuff installed on the machine I'm using to type this, but my home directory has about a hundred dot files and I don't even know what most of them are or whether they're still needed. Every file name evaluation that goes through my home directory is slowed down by this accumulated sludge.

I'm pretty sure the concept of a hidden file was an unintended consequence. It was certainly a mistake.

Nowadays, this sort of became a convention to call them "hidden" even though their contents are not hidden at all. A real hidden, or anonymous file/anonymous inode, would be implemented via opening file and holding its file descriptor open, but unlinking it from the directory, which makes the data itself to be accessible only to the program that is holding that file, and its child processes (preferably forked after unlinking the file), since child processes inherit file descriptors. In fact, this is how bash implements here-docs.

Very different story is when filename is itself a dot . or .., which actually have a bit of history behind them, and I suggest you read Why is the current directory in the ls command identified as linked to itself?

| improve this answer | |

A dot at the beginning of a filename hides the file in common file managers and for common shell programs.

The reason is historical, when ls hid the special directories . and .. by hiding everything which starts with a period. Then people used filenames starting with a period to hide files, so they are only listed with ls -a, for example to make configuration files invisible which are not needed in the ls output usually.

So the dot in chmod -R 421 .gimp is not a modifier of the command, but a part of the actual directory name.

| improve this answer | |

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.