Possible to show some dot files in Mac OS?

1.6k views Asked by At

I wanted to see the .htaccess files on my Mac (in the Finder). So I enabled the ShowAllFiles from the Terminal.

defaults write com.apple.Finder AppleShowAllFiles YES

It works like expected but the downside is that I'm seeing all the .DS_Store and .localized files.

Is there a way to only show the files named .htaccess (and possibly a few more in the future) ?

2

There are 2 answers

1
Vallieres On

A colleague suggested to leave the files hidden and use the chflags command to show only the files I want.

chflags nohidden .htaccess

Or recursively in my development folder:

find ~/ -iname ".htaccess" | xargs chflags nohidden "{}"

Hope it helps you guys like it helped me!

0
Devan On

A handy keyboard shortcut to reveal files that begin with a . (dot) in Finder is:

Shift + Command + .

This toggles . (dot) files to show/ hide without needing to restart Finder.

You can also define an alias to quickly toggle hidden files within Finder:

alias AllFilesTRUE='defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder'
alias AllFilesFALSE='defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder

This answer was found here