Feeds:
Posts
Comments

Archive for May 8th, 2018

by Tom Nelson

Your Mac is full of secrets; special files and folders hidden away so you don’t accidentally make changes to critical system components. But Apple isn’t the only one that hides items on your Mac; some developers use similar tricks to keep important secret app files, such as licensing credentials, from being used willy-nilly.

You can get in on the secrets of hiding files and folders so that others can’t easily find them, or make use of their content, with just a few simple Terminal tricks.

Using Terminal to Hide a File or Folder
Terminal has always been a favorite app of mine, so much so that I keep it in the Dock for easy access. Terminal can be used to invoke a couple of commands that can be used to hide or unhide a file or folder.

You may have already made use of the Terminal chflags command to unhide the user’s library folder, which Apple hides by default. If you’re wondering about the user’s library, often written out as ~/Library, you can learn a bit more about it in the article: Access Your Hidden Library Folder With These Five Easy Tricks.

Use the Secrets folder to hide any files or folders you wish. Screen shot © Coyote Moon, Inc.

Let’s take a look at hiding a folder using Terminal by first creating a folder that we can hide.

Open a Finder window, and navigate to your home folder. You can do this by selecting your home folder from the Finder sidebar.

Within the home folder window, either right-click in an empty area and select New Folder from the popup menu, or select New Folder from the Finder’s File menu.

A new folder will be created, and the name (untitled folder) highlighted. Enter a new name for the folder, such as Secrets.

With the Secrets folder created, it’s time to make it disappear.

Launch Terminal, located in /Applications/Utilities, and arrange the Finder and Terminal windows so that you can see both of them.

In the Terminal window, enter the following at the prompt:

chflags hidden ~/Secrets

Hit the Enter or Return key.

The Secrets folder should disappear from the Finder window.

The Secrets folder wasn’t deleted; it simply had a flag changed that told the Finder not to display it in a Finder window. The folder is still right where you created it.

We can bring it back by typing a magic word or two in Terminal:

chflags nohidden ~/Secrets

Press Enter or Return.

The Secrets folder is back.

The first chflags command hides the folder named Secrets, while the second chflags command reveals the hidden Secrets folder. Screen shot © Coyote Moon, Inc.

That’s not the only Terminal method for making a file or folder disappear. You can also make a file or folder disappear by prepending a period to its name. If we change the Secrets folder name to .Secrets the folder will become invisible to the Finder.

Alternatively, you can use the Terminal mv command, which is designed to move a file or folder to a new location, but can also be used to change a file or folder name.

In the Terminal window, enter the following:

mv ~/Secrets ~/.Secrets

Press Enter or Return.

Just as before, the Secrets folder becomes invisible in the Finder.

You can make it visible again by using the mv command to remove the period from its name.

In the Terminal window, enter:

mv ~/.Secrets ~/Secrets

Hit Enter or Return.

The Secrets folder is now visible within the Finder.

The first mv command is used to hide the Secrets folder by adding a period at the front of its name. The second mv command removes the period and makes the Secret folder visible. Screen shot © Coyote Moon, Inc.

With both the chflags and the mv Terminal commands, you’re able to make a folder and all of its contents become invisible in the Finder. You can also use the same commands on a single file, if you wish. But since the Terminal commands we mentioned require knowing the pathname to the item, it’s a good idea to just use a single folder to hide one or more items within. That helps simplify the process of remembering the required pathname when it’s time to make the items visible.

Read more on Rocket Yard, The MacSales.com Blog

Advertisements

Read Full Post »