In an earlier tutorial, we have shown you how you can reveal the hidden files in Mac OS X, via the terminal. For those who need to access the hidden files frequently, but hate to use the terminal every time to toggle the visibility of the files, how about setting a keyboard shortcut so you can quickly reveal hidden files with a single press of a key?
To make this work, we have to create a service (in Automator) to run the command and then assign a shortcut for this service.
Note: The following method is tested and working on Mac OS X Yosemite. There are a few reports stating that it might not work in 10.8 (OS X Mountain Lion) and below. We have no way to verify that, so if you are using an older version of OS X, follow this at your own risk.
Creating a service to run the reveal hidden files command
In OS X, open Automator (Applications -> Automator). It will prompt you to choose a type for your new automation. Select “Service.”
In the left most pane, select Utilities. In the center pane, select “Run AppleScript,” and drag it to the Workflow area.
In the Workflow area, first select “no input” for the “Service receives” dropdown field. Next, change the all application field to “Finder.”
In the AppleScript section, replace the line
(* Your script goes here *) with this:
script credit: Ask Different
Lastly, save this (File -> Save) with the name “ToggleHidden” (or any other name that you desire).
To test if the ToggleHidden service is working, open Finder and go to the menu (Finder -> Services) and select the “ToggleHidden” service.
If it works fine, all the hidden files should show up in the Finder. Click on it again, and the hidden files should disappear.
Assigning keyboard shortcut to ToggleHidden
The last step to complete this tutorial is to assign a keyboard shortcut to this service. Go to “System Preferences -> Keyboard -> Shortcuts.” In the left pane, select “Services.” In the right pane, scroll down until you see the “ToggleHidden” entry.
Select the “ToggleHidden” entry and click the “add shortcut” text. You can now add a keyboard shortcut for this service. For this tutorial, I set “Ctrl + Shift + H.” Just for your info, most Linux distros are using “Ctrl + H” to toggle the visibility of hidden files.
For most users, most of the time there won’t be any need to access the hidden files. But for those who need to, revealing the hidden files via the terminal can be a troublesome task, not to mention that you have to remember the command to do it. Setting a keyboard shortcut for this task will make things much easier and definitely make you more productive.
Let us know in the comments if you have any questions.
Our latest tutorials delivered straight to your inbox