View hidden folders on MacOS Mojave? cmd+shift+. does not work [duplicate]
-
29-05-2021 - |
题
Since I'm not really great with using the terminal, I would like to see hidden folders on my Mac through the regular user interface. However, I cannot show my hidden folders. I tried things I found on the internet but they did not work for me. I tried
cmd+shift+dot - nothing happens
settings > Keyboard > turning on and off "Use F1, F2, etc. keys as standard function keys"
settings > Keyboard > Shortcuts > Restore Defaults
terminal.app >
defaults write com.apple.finder AppleShowAllFiles ["yes"/"YES"/" "]
sourceat the folder I want to view the hidden contents of, I pressed Alt while clicking Go. after the "Library" folder showed up in "Go," I clicked it and saw many folders in Library, but still didn't see any folders with . in front. source
My main goal is to copy and paste into a .gitignore file that is stored in a specific folder on my desktop. I am having troubles doing it through the terminal so I thought this would be easier but it is apparently not. :)
Question: How can I fix this issue and allow myself to see hidden folders on my Mac?
I don't have a strong background in this stuff and am not trained in computer science/tech stuff.
I have macOS Mojave.
解决方案
There are two types of hidden items (files or folders) on macOS:
- Those which start with
.
whose hidden bit it set by default. - Those with no starting
.
, butchflags
set to hidden. Runman chflags
to see more info.
I clicked it and saw many folders in Library, but still didn't see any folders with . in front
Those folders are of the second type.
However, I cannot show my hidden folders.
Let's see if there's a problem with hidden files itself. In Terminal, run :
cd ~/Downloads
mkdir test_hidden && cd test_hidden
touch empty
touch .empty_h
open .
In this folder that opens, do you see files (dis)appearing if you toggle command+shift+.
?
Update: Restarting and running killall Finder
helped.
For the .gitignore
file, use ls -a
command to list all items in a directory. If there is a .gitignore
file there, you can run
open .gitgignore
to open it with default text editor. Or nano .gitignore
. Or specify a text editor: