How To Quickly Control OS X Hidden File Visibility From the Terminal

When using Finder on OS X, I prefer a clean view, without hidden files all over. But for those times that I’m actually looking for a hidden file, I want a quick way to toggle hidden files visibility. Here’s how to do it from the terminal.

Bash aliases for controlling hidden file visibility

alias hidden_show='defaults write AppleShowAllFiles YES && killall Finder /System/Library/CoreServices/'
alias hidden_hide='defaults write AppleShowAllFiles NO && killall Finder /System/Library/CoreServices/'

Just add these aliases to your favourite place for auto-loading bash stuff. If you don’t know what I’m talking about, go ahead and edit the .bash_profile file in your home directory (in terminal, you can run nano ~/.bash_profile). It’s OK to create one if it doesn’t already exist.

With these aliases configured, you can always jump into terminal, and run hidden_show to show hidden files, and hidden_hide to hide hidden files. Feel free to change the names of the aliases if you’d like to 🙂 .

Note that the aliases will become available for any new terminal session after saving the modified .bash_profile. You can apply it in existing sessions by running source ~/.bash_profile (or just reopening the terminal).

No Comments Yet.

Leave a Reply