Shell script to show/hide hidden files on OS X
If you frequently need to show/hide hidden files on OSX, here’s what I find is the easiest way so you don’t have to do a google search every time to remind yourself of the syntax.
Create a file called ’showHiddenFiles’
in Terminal, type:
chmod +x /path/to/showHiddenFiles
Make sure the location is on your path. I just use /usr/local/bin since it’s already on my path.
Edit that file with these contents:
#!/bin/sh
defaults write com.apple.finder AppleShowAllFiles $1
killall Finder
Now whenever you want to hide/show hidden files, just launch Terminal and type:
% showHiddenFiles true
– or –
% showHiddenFiles false
And don’t forget you can just type the first few letters (i.e. ’showH’), then hit TAB and Terminal should auto-complete the file name for you. Then you can just add ‘true’ or ‘false’.
