In chmod -R 421 .gimp
, what does the period mean directly preceding the g
in gimp
? Is that similar to the *
wildcard?
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
orls -A
orls --all
orls --almost-all
).However, the dot (
.
) has different meanings in different contexts:./file
) it describes the current directory you are in, while../file
refers tofile
in the parent directory..
which sources (runs) bash script files. So. ./file
(mind the spacing) would source the script namedfile
in the current directory..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)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):
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?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.
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 withls -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.