How to Hide or Unhide Files and Folders Using Terminal on Mac

Jan. 10, 2020



While macOS always seems complete to me in more ways than one, there are a few shortcomings that disappoint me at times. If the unavailability of simpledark/light modeandTurbo Boosttoggles seem hard to explain, the lack of a straightforward way to conceal confidential files has never failed to baffle me. In an age where anextra layer of shield against prying eyeshas become the need of the hour, there has to be a quick way to keep sensitive files under the wraps, hasn’t it? So, what’s the workaround? Turns out, there is a viable trick to hide or unhide files and folders with Terminal on Mac. If you feel comfortable using Terminal commands, you may find this hack quite helpful. Let’s unravel it!

Hide, View, and Unhide Files and Folders with Terminal on macOS

Hide, View, and Unhide Files and Folders with Terminal on macOS

Clearing out a few doubts right at the beginning is always better, especially when you are dealing with a hack like this one.

Nope. So, long as you have easy access to theTerminal commands(or remember them), you can quickly keep any files out of sight on your Mac. If you ever want to revert and make those files show up again or view the hidden files, you will have to go through the same route – albeit with different commands (direct path can also work for viewing). As these commands work pretty well and that too without any complexities, you can master them without any hassle. And yes, you also don’t need to be running thelatest iteration of macOSto use this hack.

  1. Now, enter thebelow-given command.Make sure not to press the Return key as yet.

  2. Next, givespaceafter“hidden”.

  3. Next up,navigate to the file or folderyou wish to hide and thendrag it to the end of the commandin the Terminal window.

  4. Finally,press the Return key.

Voila! The fill has disappeared on your Mac.

Note:While this command comes into effect immediately, at times it might not work as expected. In this case, you might need to relaunch the Finder to make the file disappear.

Wondering where has the file gone and how you can access it? Well, it’s just as straightforward.

  1. Hit theReturn key.Now, you can view all of your hidden files in Finder.

If you wish to unhide the specific files you had concealed earlier, you can do so with ease.

  1. Next, make sure to include a space at the end of the command. Then, drag the file to the end of the command and then press theReturn key.

Check out, your file has once again begun to show up in the Finder. That’s pretty much it!

So, these are the quick ways to keep all of your private files away from the prying eyes. While they work efficiently, I wish Apple offered an easier way to hide files on the macOS operating system. It would be better if the option existed inside thecustomization settingor the contextual menu itself. Well, I say it because I don’t think everyone likes to indulge with Terminal commands – barring a few pro-Mac users. What’s your take on it? Feel free to shoot your thoughts in the comments below.

An old school bibliophile who turned a tech nerd out of obsession. When he is not digging into hacks and tracking down stories that are breaking the internet, you may find him reciting poems.