If you find yourself needing to access hidden files on your Mac, like
an .htaccess file you downloaded, a .bash_profile, a .svn directory, –
literally anything preceded with a ‘.’ indicating it is invisible by
default – you can run the below command from the terminal to toggle
hidden files to become visible.
For some quick background to fill in those who don’t know, files that
are hidden in Mac OS are determined so by preceding the filename with a
single period symbol (.), you can actually make any file hidden by
placing a period in front of the name, thus making it invisible to the
Finder. Let’s make all hidden files become visible in OS X:
For OS X Mavericks 10.9 there is a very slight difference in casing:
“Hidden” files are now visible in Finder windows, but they will display as a dimmed version of their respective file icons, being slightly transparent. An example of this is highlighted below:
This setting stays in place until it has been reversed or disabled, which would cause all files to become hidden again just as the default. With all the files visible a Finder window can look much busier than you may be accustomed to, and it’s not always desired to leave on constantly. Thankfully it’s just as easy to switch back.
Another approach to without using the above defaults command is to
quickly show all hidden files in any Mac OS X Open or Save dialogue box
by hitting Command+Shift+Period on the keyboard together. You will instantly see the change as once-hidden files are revealed.
That command sequence can be used to toggle back or forth, thereby revealing and hiding the files again as needed. For many users, this keystroke is the most appropriate use for when an invisible file must be modified but there is no need to make them all visible all the time.
Another way to quickly see hidden files is by using the ls command within the Terminal, at the command line type the following:
One way to carry over the terminal to the GUI though would be to use the ‘open’ command, directed at a hidden file. Here’s an example:
Show Hidden Files on your Mac
This changes the default setting of Mac OS X so that Finder always shows all files. Launch the Terminal (found in /Applications/Utilities) and enter these commands exactly as shown. The first command activates the ability to see the hidden files:For OS X Mavericks 10.9 there is a very slight difference in casing:
defaults write com.apple.finder AppleShowAllFiles TRUE
For Mac OS X 10.8 Mountain Lion, 10.7 Lion, 10.6 Snow Leopard the setting remains the following:
defaults write com.apple.Finder AppleShowAllFiles TRUE
Hit Return, nothing happens yet because you must relaunch the Finder
for the changes to take effect. This is done by ‘killing’ the Finder
process, which is also done through the command line with the following
string:
killall Finder
Again, hit Enter/Return, and you’ll discover the Finder quits and relaunches itself very quickly with the changes in effect.“Hidden” files are now visible in Finder windows, but they will display as a dimmed version of their respective file icons, being slightly transparent. An example of this is highlighted below:
This setting stays in place until it has been reversed or disabled, which would cause all files to become hidden again just as the default. With all the files visible a Finder window can look much busier than you may be accustomed to, and it’s not always desired to leave on constantly. Thankfully it’s just as easy to switch back.
Reverse to Default & Make Files Hidden Again
To hide files that are intended to be hidden again, thus going back to the default Mac settings of keeping them invisible, you can just type the following defaults command. As you can see, everything is the same except that TRUE has been switched to “FALSE”:
defaults write com.apple.Finder AppleShowAllFiles FALSE
Remember the slight difference in OS X Mavericks has to do with capitalization:
defaults write com.apple.finder AppleShowAllFiles FALSE
Hit return, and again you will need to kill the Finder so that it can relaunch for changes to take effect:
killall Finder
That’s all there is to it!Show Hidden Files in a Mac Open or Save Dialogue Temporarily
That command sequence can be used to toggle back or forth, thereby revealing and hiding the files again as needed. For many users, this keystroke is the most appropriate use for when an invisible file must be modified but there is no need to make them all visible all the time.
Show Hidden Files on your Mac Temporarily through the Terminal
Another way to quickly see hidden files is by using the ls command within the Terminal, at the command line type the following:
ls -a
The -a flag tells the ls (list) command to show all contents,
including hidden files. You then just have to specify a directory if you
want to see the hidden files in it:
ls -a ~/Sites/betasite
This method does not effect the Finder or the visibility of hidden
files outside of using the -a flag, making it a temporary measure to
quickly see all contents of any directory or folder, even if the above
defaults command isn’t used.One way to carry over the terminal to the GUI though would be to use the ‘open’ command, directed at a hidden file. Here’s an example:
open .not_visible_by_default
This will launch the file called “.not_visible_by_default” into the
default GUI app associated with it’s file type, in this case it would be
a text file and so TextEdit would open. This trick can also be used to
open hidden directories into the Finder, for example with the following
syntax:
open ~/.git
That would launch the hidden “.git” directory in a users home
directory into a Finder window, without revealing all other files.
Post a Comment