Set Finder Preferences – Command Line

SettingĀ  the following Finder Preferences enables the specified drives to be shown on the Desktop, the same as going to Finder, Preferences, General and ticking the boxes

defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true
defaults write com.apple.finder ShowMountedServersOnDesktop -bool true
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true

To set it so that a New Finder Window shows your home folder, enter the following into Terminal

defaults write com.apple.finder NewWindowTarget PfHm