Thursday, March 5, 2015

How to display and hide back 'Hidden Files' on Mac OS?!

Sometimes you need to view the hidden files on your machine and you might be thinking of having a  show hidden files on Mac command!
And after you viewed them you might be needing to hide them again as well!

So I think this post will help you with that :)

How to show hidden files on Mac OS? :
  • Open Terminal (Finder > Applications > Utilities)
  • Run the following command in the Terminal

    defaults write com.apple.finder AppleShowAllFiles YES
  • Right click on the Finder icon in the dock while holding the ‘alt’ on the keyboard. 
  • Click Relaunch from the menu.
  • Now you can see all the hidden files in the machine.

 How to hide back the hidden files on Mac OS? :
  • Run the following command in the Terminal

    defaults write com.apple.finder AppleShowAllFiles NO
  • Now the previously displayed hidden files are hidden in the machine. 

There is another way you can do this. That is using Terminal Aliases..

How to show hidden files using Terminal Aliases? :
  • Open Terminal (Finder > Applications > Utilities)
  • Run the following command in the Terminal 

    sudo nano ~/.bash_profile
  •  Enter your password if required.
  •  Add the following lines to your .bash_profile file

    alias showFiles='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app'


    alias hideFiles='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app'
  • Press control + O > Enter   (This is to save the file)
  • Press control + X     (This is to exit from the file)
  • Run the following command in the Terminal to refresh your profile and make the aliases available 

    source ~/.bash_profile

Now when you need to show or hide the hidden files in your machine all you need to do is type the bellow commands in the Terminal and run!

To show hidden files :  showFiles 

To hide back the hidden files :  hideFiles


No comments:

Post a Comment