Linux/Unix fundamentals: Dotfiles

  • February 13, 2007
  • Avatar for peter
    Peter
    Upfold

This is going to be what's know as a fundamentals post. Today I'm going to look at an important concept, and explain it so that we can use that knowledge later. We won't necessarily do anything with practical utility with it this time round, we're mostly laying framework for future posts.

In this first fundamentals post, I'm going to take a look at dotfiles.

Under most operating systems which act like Unix, dotfiles are files which begin with a dot character (.). The important point here is that dotfiles are almost always 'hidden'.

Like files marked 'hidden' under Windows, these files won't show up while you're browsing around through a file manager or through the command line, so if you want a file to be hidden, start its name with a dot.

Beware, though, it's easy to see dotfiles. If you're in a graphical file manager, head to View > Show Hidden Files, or if you're in the terminal use:

$ ls -a

(the a switch to ls) to see hidden files.

[Quick aside - any Mac OS X users, this still applies to you - but the Finder doesn't let you view dotfiles by default. You can coax it into showing all files with a quick Terminal command (/Applications/Utilities/Terminal):

$ defaults write com.apple.Finder AppleShowAllFiles YES

Restart the Finder and then you'll see dotfiles and some OS X-specific stuff too. Change YES to NO in the command and restart the Finder again to turn back off.]

Or, if you're using a traditional Unix system in a graphical configuration, try going into your home folder and viewing hidden files. You'll see loads of dotfiles (well, folders) with names of different bits of software.

Dotfiles in ~

These are actually configuration files for all the various bits of software you might have played with (and obviously the ones you use every day). Don't delete these, or you might lose your settings! Still, know they're there.

That about concludes it for this quick fundamentals post - now you should know what dotfiles are, how you can hide stuff, and that they're often used for configuration files.

Avatar for peter Peter Upfold

Home » Articles »