Being a Mac user, every day I Google search how to show hidden files Mac and terminal commands, but every time I search I do not get the exact stuff I want. So, I researched a lot and made short easy reminders to speed up the process and do not waste time in Google Search.
Therefore, I thought let’s write a blog and help everyone on how to hide or unhide files on using Terminal on Mac. Through this blog, I am going to show short commands for Mac terminal and view hidden files and folders on Mac.
Let’s get started.
From a recent release of MacOS, we can now use shortcuts. Let’s see the shortcut to view hidden files on Mac:
You can press these keys to show hidden files and to again hide them you can use the same keys.
Additionally, if you are using a version older than MacOS Sierra, you can set up Mac terminal commands. In case, you do not know how to set up a Mac terminal, scroll down to the blog on the heading: Show or Hide Files using Terminal Aliases.
The below mentioned steps are to view hide and unhide files on Mac:
Hold the “option\alt” key to relaunch the finder by right-clicking on the Finder icon.
After relaunching, the Mac will show all the hidden files. In order to hide the files again, you can follow the similar steps but you will need to replace the Terminal command as:
Defaults write com.apple.finder AppleShowAllFiles No
For you, might be it feels like a long run or hard way to hide or unhide files on using terminal on Mac but if you will try this technique multiple times, I bet it is worth spending few minutes on these commands to save more time in the future.
Multiple commands or shortcuts are termed as Terminal Aliases. You can setup Mac terminal commands in just one step and can avoid the above mentioned 4 steps:
You can make a temporary alias (only for the use of one terminal session) or permanent as well. Follow the below-mentioned step to create temporary and permanent aliases.
“alias hideFiles=’defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app’”
In order to refresh the profile and makes the terminal aliases available.
The below-mentioned screenshot is the reference to add aliases to .bash_profile via Terminal:
Furthermore, when you wish to show hidden files, type “showFiles” in Terminal and then type “hideFiles” when you wish to hide the files again. In this order you can hide and unhide files on Mac.
Additionally, if you wish to modify the alias name or the behavior, let’s see how we can use terminal commands to modify:
alias showFiles=’defaults write com.apple.finder AppleShowAllFiles YES;
killall Finder /System/Library/CoreServices/Finder.app’
defaults write com.apple.finder AppleShowAllFiles YES;
The above-mentioned command to show or view hidden files and it ends with a “;” semicolon so that we can further provide the second command:
killall Finder /System/Library/CoreServices/Finder.app
The second command basically relaunches the Finder (in order to replicate the step to hold the “option\alt” key and then right-click the icon Finder in the clock).
Through the alias Mac terminal commands set up, all we need to do is “showFiles” and “hideFiles” in order to hide and show the hidden files or folders on Mac respectively.
The aliases are used to boost up or speed up the interaction with the Mac terminal commands. To set up an alias for the navigation of your most used directories, you can commit to a “GitHub repo” and so on you can use various commands and aliases.
Through this blog, we have learned to:
Pro Tip: You can use Smart Mac Care to save your MacBook from malicious content and actions. To read more about Smart Mac Care click on the hyperlink.
To Download Smart Mac Care at affordable price, click on the button below.
I hope you like this blog. For more such technical information and content, subscribe to our website. Additionally, if you face any issue in the process, comment down in the below section and let us know.
Thanks for reading.