Viewing Hidden Files and Folders is extremely easy, well that is if you are using Windows Operating System, as you can just select view hidden files and folder option in it to toggle the display, but I did not even recognise that there are hidden files and folders in Mac OS.
Until recently when I hot unplugged a Portable HDD from the Smart TV, When I connected it to my computer I found that some folders are missing but the available the disk space hasn’t changed. Which means the files on the disk are still there.
So at this time I remembered that there are Hidden Folders and Files, so I just opened my Terminal checked the Directory Listing (
ls) for that Drive there I saw various files and folder that where not displayed in the Finder app.
As you can see in the above image in the terminal we can dozens of various files and folders whereas in the same location in the Finder application there are only six visible folders, rest of them are all hidden.
So to view the Hidden Files and Folder we need to just run this code in the terminal
defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app
Whereas to once again hide them just run the following code :
defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app
Repeating this process everytime you want to hide and display hidden files and folders is just not productive and waste of time. So you can just create new alias in terminal and use them everytime you want to hide and show hidden file and folders.
Creating alias to Show hidden files and folders
- Open Terminal App
- In Terminal open
.bash_profilefile using your favourite text editor
- Add the following code in the file (to insert press i if you are using vim)
# Alias for show and Hide hidden files in MacOSX 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"
- Now save the file. (if you are using vim then type
- Now refresh the file in terminal by entering the following code in the terminal
- Now whenever you want to view hidden files and folders just type
showFilesin the terminal and
hideFilesto hide them once again.
With this you can view hidden Files and Folders whenever you want. Well this solution is a little difficult for users who hardly every uses terminal.
So I also found an Application for Mac which does this little trick nicely, that application is called Funter the application is extremely useful for everyone even if you are good with terminal as it gives you the option to search inside hidden files and folders.