How to reveal hidden files in OS X Terminal and Finder

OS X by convention treat files and folders with a name starting with “.” as hidden files. For example “.Trash”, “.bash_history”, “.DS_Store” etc. This is similar to other Unix based operating system.

Hidden files are normally created by system tools and utilities, and are meant not to be access by end user directly. This keeps things looking organised and prevents accidental changes to the files.

To list the hidden files under Terminal, use the “-a” option for the ls command:

$ ls -a

To reveal the hidden files in Finder, issue the following commands under Terminal:

$ defaults write com.apple.Finder AppleShowAllFiles TRUE
$ killall Finder

The first command above change the display flag to show all files in Finder app. The second command restarts the Finder to effect the change.

If you look at the Finder or the Desktop folder, you can see that there are new files that were previously hidden. To revert back to hide those files, simply reissue the same terminal commands, but change the “TRUE” flag to “FALSE”.

Hidden files are hidden for a reason. You can do serious damage to your Mac by making changes to them if you don’t know what you’re doing.