cmd + shift + .
defaults write com.apple.Finder AppleShowAllFiles false #Change 'false' by 'true' to show hidden files killall Finder
defaults write com.apple.Finder AppleShowAllFiles true
Toggle hidden files on macOS: Command + Shift + .
To show/hide press: Command + Shift + .