Thursday 12 June 2014

How to Show/Hide Files in Mac OS X?

Apple includes a way of viewing the hidden files and folders easily in Mac with the help of Terminal (Applications> Utilities> Terminal). It is a usual query, when we download any file or video clip then those files don't show up over desktop to proceed any operation further (play/delete). They are nowhere to be found in the Finder. What is unusual to notice about this query, is that video file is accessible from media player.

Those downloaded files which includes “.” in front of the name are considered "invisible" on Unix-based systems, and will therefore be invisible to a user in the Finder tab also. To locate and make those files visible, enable the ability for the Finder utility.

Step 1: Open Terminal by clicking Applications> Utilities> Terminal or right click on Finder icon in dock and click on Relaunch by holding 'Alt' key simultaneously.  

Step 2: Type the following command and hit return:
defaults write com.apple.finder AppleShowAllFiles TRUE
 
Step 3: Then, restart the Finder by typing the following command: 
killall Finder
Mac Terminal
After restarting the Finder, all hidden files will be shown in grey shade by carrying a dot in front of the name with Delete, Edit etc. operations to perform; but be careful not to delete any files that you don't identify, as some hidden files control the way Folders are configured.

As you done with the visibility of hidden files via Terminal, you can easily revert the Finder to the original state (not showing hidden files) by following the same Terminal steps above, replacing "TRUE" in the first command with "FALSE".

Show/Hide Hidden Files using Terminal Aliases


It is cumbersome to type this long command again in case of showing invisible files. Using an easy to remember alias, the above mentioned command can be reduced to a single one easy to remember phrase or word.
An alias tells the system terminal that we adding a new alias and can be made temporarily for one terminal session or permanently.
  1. Launch Terminal (Applications > Utilities)
  1. In Terminal, copy and paste the following command:
sudo nano ~/.bash_profile
  1. Enter your Mac’s administration password if required, then press return
  1. After typing the above command, now copy and paste the following:
alias showmyFiles='defaults write com.apple.finder AppleShowAllFiles YES;
killall Finder /System/Library/CoreServices/Finder.app'
  1. Below that, paste the following: alias
hidemyFiles='defaults write com.apple.finder AppleShowAllFiles NO;
killall Finder /System/Library/CoreServices/Finder.app'
Mac Terminal
  1. Press Command + O and press return to save the file
  1. Press Command + X to exit and return to the command line utility
  1. In Terminal, paste the following: source ~/.bash_profile to refresh your profile and make the aliases available
Now when you want to show hidden files, all you need to type in Terminal is showmyFiles, then hidemyFiles when you want to hide them.
 
(Note: showmyFIles is the name of alias. Different name can be typed as per the comfort)

No comments:

Post a Comment

To make your comment live kindly pay attention :-

Don't include spam words and
Don't give links in your comments.