Show hidden files in finder terminal alias

2018-07-09

MacOS has the annoying perk to keep you on training wheels unless you show your worth. So, in order to keep my mum and grandma from deleting important files, MacOS hides them by default. To show them, you can either always use the shortcut Command + Shift + Period whenever you want to toggle hidden files. Or you can add an alias to zsh.

To do that you open .zshrc that you find in your root directory and add the following to your terminal.

alias show_hidden='defaults write com.apple.Finder AppleShowAllFiles YES && killall Finder'
alias hide_hidden='defaults write com.apple.Finder AppleShowAllFiles NO && killall Finder'

This lets you trigger to show/hide hidden files with a more permanent effect.

While you’re at it, do yourself a favor and add another alias:

alias zshconfig="vim ~/.zshrc"

That’ll take you to the zsh config quickly in the future.