Thursday, September 2, 2010

Terminal command to show hidden files [Mac]


6:23 PM |

Mac OS X hides files beginning with a period “.” by default. One of the reasons for this is that important system files have names beginning with a period. Ideally, you shouldn’t touch such files, but there are occasions when you need to – a web developer may have to edit local .htaccess files, for example. I need this when editing .htaccess files for WordPress development.

Given below is a method to view hidden files with a Terminal command, but if you use a code editor (Textmate, TextWrangler etc.) or FTP tool (Transmit, Cyberduck etc.), you can view hidden files in it instead.

For everyone else, the easiest way to enable/disable showing of hidden files in Mac OS X – useful is with a two-line command to be entered into the terminal. Enter the commands below by copy-pasting, to Terminal. You can open Terminal from Applications > Utilities > Terminal, or by typing the first few letters into Spotlight.

defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
Note that they are two different commands, so if you write this by hand (not sure why you would), ensure there is a line break. As is evident from AppleShowAllFiles, once you do this, you can view all hidden files and folders.

To revert, ie. hide files beginning with “.”, replace TRUE with FALSE in the above command.

Leave A Comment