I am having a hard time grasping what dot-files are or what they are for. Are they directories? How do I navigate to them?
Thank you!
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communityI am having a hard time grasping what dot-files are or what they are for. Are they directories? How do I navigate to them?
Thank you!
In Unix/Linux dot-files refers to files/directories with a .
prepended to their name. Examples are ~/.bashrc
, ~/.bash_profile
, etc. The leading dot .
is used as an indicator by software like bash and nautilus to not list these files normally but only when they are specifically requested like pressing Ctrl+H in Nautilus. This is because, generally, dot-files are used to store configurations for different applications but they are sometimes used otherwise as well. For example Mozilla creates a .mozilla
folder which contains their configuration files as well as browser cache.
People tend to backup & also share their dot-files so others can boot-strap their own applications using those configuration files. An example of a site dedicated to sharing dot-files is http://dotfiles.org.
ls -a
, for example.
Jan 12, 2012 at 7:51
If you mean when there's a . in front of a file name... The file is hidden. It won't show up unless you make your computer show hidden files and folders.
Try making a new folder, and renaming it to something that starts with a . and then watch it disappear.
Dot files are hidden, as Daniel and Sai said before. If you list files in the directory, they normally don't show up.
In a GUI, mostly file-open/file-save dialogs, you hit the right mouse button, and get a context-menu, allowing you to show hidden files
.
Here is, how to handle them in the shell:
$ > touch a b c .d .e f.f g.
(generated testdata)
$ > wc -l *
0 a
0 b
0 c
0 f.f
0 g.
0 total
As you can see, the first command does not reveal .d and .e
$ > wc -l .*
wc: .: Is a directory
0 .
wc: ..: Is a directory
0 ..
0 .d
0 .e
0 total
wc -l .*
shows them, and the 2 special files, .
which is the PWD, the present working dir, and ..
which is the parent of the pwd.
$ > wc -l .* *
wc: .: Is a directory
0 .
wc: ..: Is a directory
0 ..
0 .d
0 .e
0 a
0 b
0 c
0 f.f
0 g.
0 total
wc -l * .*
works on normal and hidden files (which again repeats PWD and the upper directory, but for other commands, * .* might fit better, for example
find -type f \( -name "*" -or -name ".*" \) -execdir wc -l {} ";"
Which will not show the directories .
and ..
.
If you use firefox for file system browsing, file://home/joe you have an option box to show/hide those files.
ls
is a bad example, I changed the example to use wc -l
instead.
Jan 12, 2012 at 9:34
To clear up some possible confusion... there is nothing special about files or folders beginning with a dot, but by convention, they are simply not displayed unless you specifically request them to be. They are, by convention, for configuration files or directories in your home folder, with the dot prepended (not appended) to keep the directory listings cleaner.
The conventional way to see them is by adding an a, for all, to the ls command if you are using a terminal. This can be combined with other switches (letters following a hyphen):
ls -a
In a graphic file manager, you will need to choose either "show hidden" or use the hotkey (in Nautilus, it is Ctrl-H) to see these files.
Note that you can still enter the name if you know it's there - it is a valid filename, and is no different than any other file or directory. It is opened and saved just like any other.
The how do I navigate to them wasn't answered from a GUI perspective. In nautilus do a Ctrl-H and you'll toggle visibility for "." files and folders in that nautilus window. There's also a selection for visibility in the View text menu.