Show hidden files on Mac OS X Mojave using Terminal To see my /etc folder I've tried this command in Terminal:

sudo chflags nohidden /etc


followed by:

sudo defaults write com.apple.Finder AppleShowAllFiles true; killall Finder


also tried:

sudo defaults write com.apple.Finder AppleShowAllFiles YES; killall Finder


Neither of them seemed to work.
Session

This keystroke toggles between show &amp; hide the hidden files: 

 Cmd ⌘   Shift ⇧   .  (that’s a FULL STOP, period character)

Press again to toggle back and forth.

When you reboot your Mac, the hidden files will be hidden. Press the keystroke again to show.

Persistent

In Terminal.app, paste:

defaults write com.apple.finder AppleShowAllFiles -boolean true; killall Finder 


This changes the default setting to show hidden files. And this causes the Finder to restart, so you can see the effect. This new setting persists even after rebooting your Mac.

To revert to hiding again the hidden files, change that true to a false and run again in Terminal.