OSX Quick Tip: Show all files in the Finder including dot filesPosted in OSX and Quick Tips -
The default behavior of the Finder on OSX is to hide UNIX files such as /usr /var etc and dot files (e.g. .htaccess). This quick tip shows how to enable (or disable) showing these files.
Enable showing all files in Finder
Open up a terminal and enter this command:
defaults write com.apple.finder AppleShowAllFiles YES
and this command to relaunch Finder:
Note that doing this means all the .DS_Store files will appear too.
Disable showing all files in Finder
The same as the above but NO instead of YES:
defaults write com.apple.finder AppleShowAllFiles NO killall Finder
Scripting / Saving as a Finder plugin
After writing this post, I found a post at The Apple Blog which shows how to do the same thing but save it as a clickable option in the Finder so you can easily switch on and off showing these files. (But see my update below for an even better way).
Note that in the current version of OSX (10.6.3 at the time of this post) the "Run Shell Script" option in Automater is under Library -> Utilities and then select "Run Shell Script" from the next pane. You also appear to need to create it as as service and not an app as shown here.
Note also that if you select "no input" and "any application" then it will appear in the services menu for any application, should you wish it to work this way. At the very least, I found have "no input" with Finder as the app the best way to do it.