Hiding Folders On Your Mac 21
Terminal
Hey
Quite a while ago I mentioned a method of password protecting your folders to keep your “work” safe from prying eyes. Although this was a good way to keep stuff safe, people could still see it. This method is to hide folders so that they don’t appear in Finder. They will appear if you have set your computer to view hidden files, but most people don’t have that option.
To make a folder hidden is really simple. There are two ways. Terminal and a normal way. The normal way is to add a dot (.) in front of the folder. This makes it hidden a warning may appear about the change.
The better and more fun way is to use Terminal. Simply open up terminal and type the following:
mkdir /Path/To/Folder/You/Want/To/Hide/.folder
This folder will be instantly created. No warnings. Remember the dot. Its very crucial. You can then view the hidden folder by opening up Finder. Pressing Command + Shift + G or going to Go > Go To Folder. A normal Finder will appear in which you can access your documents.
If you want to delete this folder. In Terminal type:
rm -rf /Path/To/Folder/You/Want/To/Hide/.folder
The folder will then be deleted. It wont be sent to the trash.
Finally if you want to rename you porn work folder so it becomes unhidden. Simply type:
mv /Old/Path/.test /Old/Path/test
The mv command is the move and rename command. The first section is your source the second section is your destination. You can move and rename in one fell swoop with the mv command.
Hopefully you have got to grips with hiding folders, plus some other tips along the way. If you have anything else to share, please leave a comment.
If you want to take your skills with Terminal a bit further I recommend you check out the Terminal Category on this site. If you fancy reading a book there is a couple on Amazon that I regularly see mentioned and recommend, O’reilly Unix Geeks and Unix Under the Hood both are designed for Mac OS X and take Terminal further.
If you want to keep up with the latests post from Mac Tricks And Tips I recommend you subscribe to the RSS Feed.
Where To Next?
21 Responses to “Hiding Folders On Your Mac”
-
1
A better way to do this is the “chflags” command.
I blogged about this here.
Essentially:
chflags hidden ~/Desktop/file.txt
Hides a file and:
chflags nohidden ~/Desktop/file.txt
Unhides a file.
Keep in mind that this just makes the GUI not show the file. A simple “ls ~/Desktop/” will reveal it. Although, the same applies with a dot-folder if you use “ls -a ~/Desktop/”.
MacTipper
My Mac-Tipping BlogComment By MacTipper on June 3rd, at 10:33 pm
-
2
I tried this and it didn’t work.
to test it I put:
mkdir /users/Brenner/Documents/Sing that iTune!/spoon.folderbut it says “no event found”
what am I doing wrong?
Thank you
Comment By Brenner on June 4th, at 12:19 am
-
3
Brenner, the dot needs to be at the beginning of the folder name.
“.spoon folder” instead of “spoon.folder”
Comment By Anonymous on June 4th, at 12:52 am
-
4
this time, I put
mkdir /users/Brenner/Documents/Sing that iTune!/.spoon folder
and also tried
mkdir /users/Brenner/Documents/Sing that iTune!.spoon folder
neither worked…..?
(those are exactly what I typed)Comment By Brenner on June 4th, at 1:06 am
-
5
You need to escape your spaces or quote the path. Usually, what I do is if I’m doing something with the home shortcut (~) I’ll escape spaces:
mkdir ~/Desktop/New\ Folder/
And if I’m doing a full path, I’ll quote:
mkdir ‘/Users/oliver/Desktop/New Folder/’
Notice that to escape the space, you simply put a \ in front of it.
MacTipper
My Mac-Tipping BlogComment By MacTipper on June 4th, at 1:10 am
-
6
Ok I’ve never used Terminal before so I really don’t understand much of what you just said….
could you…
type exactly what I want to type so that I could copy it into terminal and I can learn from that
and/or tell me why when I put a “.” in front of any folder, it tells me it’s reserved for the system, and changes the folder back to what it was originally. and how to make it not do that anymore.
Thank you
Comment By Brenner on June 4th, at 2:24 am
-
7
So, you want:
/Users/Brenner/Documents/Sing that iTune!/.spoon folder
to be made?
You’ll need the make folder (Make directory) command, which is “mkdir”. You then add the path onto that after a space. Knowing this:
mkdir ‘/Users/Brenner/Documents/Sing that iTune!/.spoon folder’
will make a folder called “.spoon folder” inside your ~/Documents/Sing that iTune!/ folder. However, you won’t be able to see it from the Finder. To find out if it’s there, use this command:
cd ~/Documents/Sing\ that\ iTune!/; ls -a
(Notice that between “Sing” and “that” I put a \ before each space. This is because I didn’t single-quote the path.)
You cannot use Finder to make folders with a period at the beginning because these are only supposed to be used by the operating system.
Hopefully this makes sense,
MacTipper
My Mac-Tipping BlogComment By MacTipper on June 4th, at 2:39 am
-
8
Ok that helped a lot, thanks I get it now.
But I still didn’t understand how to use
cd ~/Documents/Sing\ that\ iTune!/; ls -a
because I put that in and it didn’t work at all
but the one before in the original post worked to rename it so it all worked out.
Thank you!
Comment By Brenner on June 4th, at 4:11 am
-
9
Thanks for the help MacTipper. I was sleeping so I couldn’t do anything. Anyway, there are hundreds of ways to hide folders and anything in Terminal. I think the best way of finding a solution to a probably is to go the simple route. For example don’t add the space. May be a little less easy to use, but it works.
Comment By James Powell on June 4th, at 7:56 am
-
10
What I did was create an encrypted disk image named .Files. Then I created a simple AppleScript to run a shell script to mount it. Using Quicksilver, I set up a keyboard trigger to run the AppleScript, so I don’t have to go looking for the hidden DMG. I just hold the keyboard trigger and the disk image’s password dialogue box pops up.
Of course, for this to work Quicksilver has to be running, but why would it not be running???
Here’s the script:
do shell script “hdiutil mount ” & quoted form of “/.Files.dmg”–where “/.Files.dmg” is the path to your DMG.Comment By Ryan on June 5th, at 8:06 am
-
11
Very neat. I like it.
Comment By James Powell on June 5th, at 8:08 am
-
12
Hi,
I also tried to use the Treminal with the script you offered to create a hidden folder on my desktop but also had no luck. does this script work on
OSX 10.4.11 running on a powerbook titanium? any info would be greatly appreciated.Comment By Jon on June 6th, at 3:46 am
-
13
Bummer. I tested it on a Tiger machine and, regrettably, the chflags command doesn’t work.
That’s a disappointment!
Comment By MacTipper on June 6th, at 4:31 am
-
14
Do you know of a way that i can create a hidden folder on my desktop – or will it have to be inside of another? Honestly..either would do. Thanks in advance for your help.
Comment By Jon on June 7th, at 3:33 pm
-
15
Open Terminal and type:
mkdir ~/Desktop/.hidden_folderHit RETURN. Then type:
cd ~/DesktopHit RETURN. Then type:
ls -aYou will see the hidden_folder listed. Did you read the post?
Comment By Ryan on June 7th, at 7:26 pm
-
16
[...] while ago I mentioned about a method of hiding folders by making a folder into a dot folder. Dot folders are by default hidden on a Mac, since they are [...]
Comment By Hiding Folders | Mac Tricks And Tips on July 22nd, at 2:17 pm
-
17
I’ve been doing some tinkering and found that this also hides single files which I find interesting, don’t know if you all found that out. It’s the same basic command as listed but you type out the name of the file that you want to hide, including the file extension, I.E: .jpg …. then in the second part you type out how you want it to be hidden exactly like the folder with the period at the beginning of the hidden file name.
*Remember, if your going to bring it back, you have to include the file extension at the end of the file name. I haven’t tried without it because I suspect bad things to happen >>In Terminal:
mv /Users/_______/Desktop/fail-owned-manhood-fail.jpg /Users/______/Desktop/.fail-owned-manhood-fail <— Will hide the individual file *(Please note that the directory address will differ from system to system, this is what I would include, I left out the username because you don’t need to know who I am.)*
mv /Users/______/Desktop/.fail-owned-manhood-fail /Users/_____/Desktop/fail-owned-manhood-fail.jpg <—- Will bring your individual file back.
Comment By Velociraptor on September 23rd, at 8:20 pm
-
18
just show your hidden files FIRST and THEN add the “.” before the name… worked for me when all else failed.
Comment By Diego on December 30th, at 8:06 am
-
19
HI
I CREATED A HIDDEN FOLDER BUT I FORGET THE NAME OF THE FOLDER HOW TO FIND OUT THE NAME OF THE FOLDER
THANX
Comment By GAURAV on January 24th, at 11:53 am
-
20
ls -a in the directory you want to find the file.
Comment By admin on January 24th, at 1:44 pm
-
21
Hi,
I have a problem in Finder!
to day when turn on my MacBook, show all system hidden folder/files…!
how can don’t show hidden files?!
please help meComment By Parhum on March 3rd, at 6:39 am

