Via Shell this way:
#!/bin/bash
# Toggle Finder showing hidden files
#
# From: www.chipwreck.de
value=`defaults read com.apple.finder AppleShowAllFiles`
if [ $value == "TRUE" ]
then
defaults write com.apple.finder AppleShowAllFiles FALSE
else
defaults write com.apple.finder AppleShowAllFiles TRUE
fi
killall Finder
exit 0