Hiding files on MacBook Air 2020 desktop

I honestly don't know if I'm doing it right but I've tried continuously to hide my files. Terminal dosen't work and whenever I go on files click on the folder and press  Shift+CMD+(.) nothing happens. Is there another way to hide it or am I doing it wrong?

MacBook Air, macOS 13.5

Posted on Sep 6, 2023 04:24 PM

Reply
Question marked as Top-ranking reply

Posted on Sep 6, 2023 05:33 PM

Files/Folders in macOS can be hidden is two ways. The first is to start the file/folder name with a . as noted by Encryptor5000. The second is to set a Finder flag on the item(s). By using a Finder flag, you do not need to alter the file/folder name.


Let's use an example of a folder on your Desktop called SecretStuff. The relative path is ~/Desktop/SecretStuff. To see the permissions and the flags, open Terminal and run this command:


ls -lO ~/Desktop


(that is a capital o, not a zero)


You should see a line something like this:


drwxr-xr-x  2 youraccount  staff  - 64 Sep  6 20:19 SecretStuff


To set the hidden flag on that Folder, open Terminal and execute the following command:


chflags hidden ~/Desktop/SecretStuff


Repeat the ls -lO command to see the addition of the hidden flag in the flags column.


ls -lO ~/Desktop                 

drwxr-xr-x  2 youraccount  staff  hidden 64 Sep  6 20:19 SecretStuff


The folder is now hidden. Using Command Shift . you can toggle between show all files/folders and show visible files/folders.


Please note, while both methods above will hide an item, items with the hidden flag can still be found by Spotlight. Items that start with a . will not appear in Spotlight results (via Spotlight menu or mdfind).


Also, make sure you do not forget about your hidden items. Out of sight, out of mind. Make sure you backup the data in these hidden folders or put things in there that you can live without.


To unhide an item hidden by a finder flag, simple reset with the nohidden flag like this:


chflags nohidden ~/Desktop/SecretStuff  


Hope this helps. Don't forget where you hid stuff.

3 replies
Question marked as Top-ranking reply

Sep 6, 2023 05:33 PM in response to Iexsia

Files/Folders in macOS can be hidden is two ways. The first is to start the file/folder name with a . as noted by Encryptor5000. The second is to set a Finder flag on the item(s). By using a Finder flag, you do not need to alter the file/folder name.


Let's use an example of a folder on your Desktop called SecretStuff. The relative path is ~/Desktop/SecretStuff. To see the permissions and the flags, open Terminal and run this command:


ls -lO ~/Desktop


(that is a capital o, not a zero)


You should see a line something like this:


drwxr-xr-x  2 youraccount  staff  - 64 Sep  6 20:19 SecretStuff


To set the hidden flag on that Folder, open Terminal and execute the following command:


chflags hidden ~/Desktop/SecretStuff


Repeat the ls -lO command to see the addition of the hidden flag in the flags column.


ls -lO ~/Desktop                 

drwxr-xr-x  2 youraccount  staff  hidden 64 Sep  6 20:19 SecretStuff


The folder is now hidden. Using Command Shift . you can toggle between show all files/folders and show visible files/folders.


Please note, while both methods above will hide an item, items with the hidden flag can still be found by Spotlight. Items that start with a . will not appear in Spotlight results (via Spotlight menu or mdfind).


Also, make sure you do not forget about your hidden items. Out of sight, out of mind. Make sure you backup the data in these hidden folders or put things in there that you can live without.


To unhide an item hidden by a finder flag, simple reset with the nohidden flag like this:


chflags nohidden ~/Desktop/SecretStuff  


Hope this helps. Don't forget where you hid stuff.

Sep 6, 2023 04:32 PM in response to Iexsia

MacBook Air Said:

"Hiding files on MacBook Air 2020 desktop: I honestly don't know if I'm doing it right but I've tried continuously to hide my files. Terminal dosen't work and whenever I go on files click on the folder and press  Shift+CMD+(.) nothing happens. Is there another way to hide it or am I doing it wrong?"

-------


Hiding Files on a Mac:


Create Custom Shortcut:

Try creating your own shortcut. Report back if that works: Create a Custom Shortcut on Mac - Apple Support

Sep 6, 2023 05:06 PM in response to Iexsia

Hi lexsia,


Command-Shift-Period shows or hides folders and files that are already marked as hidden.


Before proceeding with the steps below, can you please explain what you're trying to accomplish? Hiding files in this manner is unusual, and there's probably a better way to achieve what you want to accomplish.


To easily mark a file or folder as hidden, put a period (.) as the first character of the file/folder name. The Finder won't let you do this, but Terminal will:


  1. Open a Terminal window.
  2. Type "mv" and add a space. Don't hit Enter (Return) yet.
  3. Drag the folder or file you want to hide into the Terminal window, twice.
  4. Use the arrow keys to adjust the Terminal text cursor, then place a period at the start of the folder/file name in the second path.
  5. Hit Enter (Return).

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Hiding files on MacBook Air 2020 desktop

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.