Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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!

share|improve this question
    
add comment

5 Answers 5

up vote 21 down vote accepted

In Unix/Linux dot-files refers to files/directories with a "." appended to their name. Examples are ~/.bashrc ~/.bash_profile etc. The leading dot (.) is used as an indicator by softwares 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.

share|improve this answer
    
I would put 'configuration' in parens, and 'hidden' not. For example mozilla creates a .mozialla folder, which does not only contain configuration, but Cache too. Similar .mozialla-thunderbird, where all my emails live. –  user unknown Jan 12 '12 at 4:59
    
these are almost exactly what I was looking for. The only thing I would like to know is how you would navigate to these hidden files or directories after they become hidden? –  RafLance Jan 12 '12 at 5:58
1  
Hiding these files is a convention, not an OS service. Any program can access them normally; how to tell programs to display them depends on the program itself. You can see them on the console using ls -a, for example. –  Simon Richter Jan 12 '12 at 7:51
    
In some (most?) open/save dialogs, you can also right-click in the file list and choose "Show hidden files" or something similar. –  Michael Kjörling Jan 12 '12 at 8:34
    
One thing I have learned through extensive lurking is that (for me) when I hit Ctrl+H, hidden files and folders will become visible in the file explorer. –  RafLance Mar 23 '12 at 16:12
add comment

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.

share|improve this answer
add comment

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:

example:

$ > 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.

share|improve this answer
3  
ls -a also shows all and is a bit shorter than ls * .* ;) –  Rinzwind Jan 12 '12 at 8:31
    
Nice catch, you're right. ls is a bad example, I changed the example to use wc -l instead. –  user unknown Jan 12 '12 at 9:34
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

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.