From LQWiki
Jump to: navigation, search

A dotfile is any file (or directory) prefixed by a period ('.'). On UNIX systems, dotfiles are hidden from the output of ls. To see the files, use "ls -a". They are not truly hidden, but by convention programs that deal with the user should not show any filename starting with a dot unless the user says otherwise. The uses of dot-files vary, but they should not be considered truly hidden, or secure, despite the name of "hidden files". However, because of the convention they can be used by crackers to hide their root kits from unsuspecting users or system administrators.

This means that they are not included in the file list you get with an asterisk in the shell:

tweedleburg:~ # mkdir test
tweedleburg:~ # cd test
tweedleburg:~/test # touch .testfile
tweedleburg:~/test # touch file1
tweedleburg:~/test # ls -a
.testfile  file1
tweedleburg:~/test # ls *
tweedleburg:~/test # 

As you see in the example above, the files .testfile and file1 exist, but only file1 is shown for ls *.

Dotfiles can be used to reduce clutter in a user's home directory,

Programs (by convention) store their user-specific configuration in a dot file (or files) in the user's homedir. For example kde stores its settings in the directory .kde/ of the user's homedir.

Take care if you want to backup your home directory! Taking a backup with the command

tar cvzf backup.tar.gz *

will NOT save your dot files, better use

tar cvzf backup.tar.gz .