how to view hidden files in mac terminal

Shell
defaults write com.apple.Finder AppleShowAllFiles false
#Change 'false' by 'true' to show hidden files
killall Finderdefaults write com.apple.finder AppleShowAllFiles YES
Source

Also in Shell: