In this guide we will see how to show or hide hidden files in Mac OS. All you need to do is type a simple command in terminal. Later, in this guide we will also see how to create aliases to make things faster so that the users can quickly show and hide hidden files.
Show hidden Files in Finder using Terminal
- Open Terminal. Go to Finder ❯ Applications ❯ Utilities ❯ Terminal. You can also use spotlight search to open terminal quickly, press
Command+ Space, type Terminal and hit return.
- Type the following command in terminal and hit return.
defaults write com.apple.finder AppleShowAllFiles -bool TRUE;killall Finder
- Now you can see hidden files in finder.
Hide hidden Files in Finder using Terminal
If you want to go back to hide your hidden files then you can do so by typing following command.
defaults write com.apple.finder AppleShowAllFiles -bool False;killall Finder
hit return. This will again hide your hidden files.
What to do when you need to switch between show and hide frequently? Use Aliases
For those who wants to switch between show and hide often, writing these commands again and again could be irritating. To simplify this process you can create aliases, they are just shortcuts to your command line commands that your write on terminal, so instead of writing the whole command every time you can create an alias for your command. This way you can run the command by just typing alias name.
There are two types of aliases: temporary and permanent. As the name suggests the temporary aliases lasts for the current terminal session, they are vanished as soon as you close the terminal, however you can use them any number of times until the terminal is not closed. On the other hand, permanent alias lasts forever, you need to edit .bash_profile file to record permanent aliases.
Note: In this guide, I will only share the process of creating temporary alias as the process of creating permanent alias is little bit complex and not suitable for beginners.
So, back to the point. To create temporary alias for show and hide command do this:
Type this in terminal
alias showme='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder’
alias hideme='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder'
That’s it guys. Now you can use them any number of times by just typing showme and hideme in terminal. Alias showme will show hidden files and hideme will hide hidden files. But remember that once you close the terminal these alias would be vanished and you need to create them again in order to use them.