Show and hide hidden files on mac

This should be a simple matter, but it troubled me so much.

Simply, you need to the followings, but be warned that there are slight incorrect version of command on internet, at least which didnt’ work for me on Lion.

On Mavericks

defaults write com.apple.finder AppleShowAllFiles TRUE

On Mountain Lion

defaults write com.apple.Finder AppleShowAllFiles TRUE

Then

killall Finder

But personally, I wouldn’t want to see all hidden files in Finder. Rather, in bash, I can

ls -al

drwxr-xr-x+ 56 andrewchaa  staff   1904 25 Oct 03:41 .
drwxr-xr-x   6 root        admin    204 23 Oct 00:48 ..
-rw-------   1 andrewchaa  staff      3 26 Oct  2011 .CFUserTextEncoding
-rw-r--r--@  1 andrewchaa  staff  39940 25 Oct 03:32 .DS_Store
drwx------   2 andrewchaa  staff     68 24 Oct 22:45 .Trash
...
Show and hide hidden files on mac