How To: OS X Yosemite show hidden files and folders

The way I did it in Mavericks doesn’t work now, so here is the Yosemite way…

Show Hidden:

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

and to hide them:

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