If you are a Mac user it's not likely but you may have run into a situation where you want to show hidden files. If you admin a Mac OS X server, especially a Mac OS X web server, you have almost certainly needed to show hidden files.
In either case leaving the files unhidden creates problems. If you are just a Mac user you almost certainly don't want all those hidden files cluttering things up all the time, meaning you will want to hide them again. If you are administering a Mac server it's less of an issue, unless you use Dropbox.
If you do you have likely noticed that leaving hidden files shown seems to confuse Dropbox – syncs never complete. Hide the hidden files again and everything goes back to normal – the sync completes just as it should.
That means that you likely need to flip back and forth between showing and hiding hidden files. If for example you want to make a quick edit to a .htaccess file you need to first show hidden files, then make the change, then hide hidden files again to avoid the problem with Dropbox.
Traditionally this is done with the terminal app. The following steps show hidden files:
The first line tells OS X to show all files, including the hidden ones. The second line restarts the Finder, which is essential for the change to take effect. If you are looking at the desktop you first notice that al icons disappear as the Finder restarts, then all the icons (plus those formerly hidden) reappear.
The steps to then hide the hidden files again look like this:
This time the first step tells OS X to go back to hiding hidden files and again the second step restarts the Finder, forcing the change to take effect. Again all icons will briefly disappear but this time only the normally visible files will reappear. It's a little bit of work.
An easier option is to create an Automator script that toggles back and forth between showing/hiding hidden files. You can then just leave an alias to the script on your desktop, and clicking it flips you back and forth between showing/hiding hidden files.
But this might be the best way of all to flip back and forth. It takes a little bit of work in Terminal to set up. Not everyone is comfortable or completely at home in Terminal but they are likely more familiar with it than with Automator, so fumbling around in Terminal for a couple of minutes is probably easier than learning Automator.
The end result is that you simply need to enter showFiles or hideFiles (case sensitive!) into Terminal to change the view. A little more work than just clicking on an Automator script but it feels more intuitive, at least to me.
If the approaches above seem a little daunting, or you're not comfortable messing around with Terminal, or (best reason yet) you realize that a file worth hiding is a file worth encrypting check out the app Hider 2.