Hidden files are files that don't show up in Finder by default. On Mac, any file or folder starting with a dot (.) is hidden.
They're not secret - just tucked away to keep things tidy.
Why They Exist
Hidden files are usually configuration files that:
- You rarely need to see
- Clutter the view if visible
- Could cause problems if accidentally modified
Examples:
.zshrc- shell configuration.gitignore- git ignore rules.DS_Store- Finder metadata.ssh/- SSH keys and config
Show Hidden Files in Finder
Press this keyboard shortcut:
Command + Shift + .
Hidden files appear (slightly faded). Press again to hide them.
Show Hidden Files in Terminal
By default, ls hides dotfiles. Add -a to show all:
ls -a
Output:
. .. .zshrc .gitignore Documents Downloads
The . and .. are special:
.= current directory..= parent directory
Common Hidden Files
| File/Folder | Purpose |
|---|---|
.zshrc |
Shell configuration |
.bash_profile |
Bash configuration |
.ssh/ |
SSH keys and config |
.gitconfig |
Git configuration |
.gitignore |
Files git should ignore |
.DS_Store |
Finder folder metadata |
.Trash/ |
Your trash folder |
.npm/ |
npm cache |
.vscode/ |
VS Code settings |
Creating Hidden Files
Just start the name with a dot:
touch .myconfig
Or in any save dialog, type the name starting with a dot.
Making Files Hidden/Visible
Hide a file (add the dot):
mv myfile .myfile
Unhide a file (remove the dot):
mv .myfile myfile
The .DS_Store Files
You'll see .DS_Store in almost every folder. It stores Finder preferences for that folder (icon positions, view settings, etc.).
They're harmless but annoying in git repos. Add to .gitignore:
.DS_Store
Hidden Folders in Your Home Directory
Your home folder has many hidden items:
ls -la ~
Common ones:
.ssh/- SSH keys.config/- App configurations.local/- User-specific data.cache/- Cached data.Trash/- Deleted files
Permanently Show Hidden Files in Finder
If you always want to see hidden files:
defaults write com.apple.finder AppleShowAllFiles YES
killall Finder
To hide them again:
defaults write com.apple.finder AppleShowAllFiles NO
killall Finder
Why Some Files Should Stay Hidden
Don't randomly edit or delete hidden files. They often:
- Configure important programs
- Store security credentials (
.ssh/) - Maintain application state
If you're not sure what a hidden file does, leave it alone.
Finding Hidden Files
Search for all hidden files in a directory:
ls -la | grep '^\.'
Find hidden files recursively:
find . -name ".*" -type f
Keep Learning
Understanding hidden files helps you configure your Mac properly. The free course covers file management and more.
Check it out at Mac Terminal for Humans.