If you have ever come across a need to have Mac OS X show the files starting with a dot (.) in your GUI, you may have found the command to do it, only to forget it later. Instead of remembering the command, why not just create a logical shortcut that does the job for you?
In my case, I have created two new commands on my system:
Here’s how to set this up:
Add the following three lines to your ~/.profile file (you can use vim or nano):
alias show-hidden='defaults write com.apple.finder AppleShowAllFiles YES && killall Finder'
alias hide-hidden='defaults write com.apple.finder AppleShowAllFiles NO && killall Finder'
If you do not know the command to edit your ~/.profile file, here’s what you can use (I’m giving the nano example since most find nano easier to use than vim):
When you are done, save the file and quit the editor with the following keystrokes (control + o, enter, and control +x):
Source your ~/.profile file:
Test it out:
- Open your finder window and navigate to your home directory. You should see no hidden files unless you have previously executed the commands to make them show.
- Run the following commands in any order you wish, any time you want and they will control wether hidden files show up or not (if you watch your Finder window while you run them, you will see the changes made in real time):