Skip to content

Instantly share code, notes, and snippets.

@zlargon
Last active August 29, 2015 14:25
Show Gist options
  • Save zlargon/25cfc03a00c9a9225799 to your computer and use it in GitHub Desktop.
Save zlargon/25cfc03a00c9a9225799 to your computer and use it in GitHub Desktop.
[MAC OSX] Show/Hide the hidden files in Finder.
# [MAC OSX] Show/Hide the hidden files in Finder.
# add this function to '~/.bash_profile' and reopen terminal.
# Usage: show-file -> show
# show-file 0 / off / hide / false -> hide
show-file () {
opt=$(echo $1 | tr '[:upper:]' '[:lower:]') # transfer into lowercase
# Hide Files
if [ "$opt" = "off" ] || [ "$opt" = "0" ] || [ "$opt" = "false" ] || [ "$opt" = "hide" ] ; then
echo "Hide all the hidden files in Finder."
defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder
return
fi
# Show all the Files
echo "Show all the hidden files in Finder."
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder
echo "Use 'show-file off' to hide the hidden files in Finder."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment