There are many changes to Finder, Dock, etc. preferences that you can do with the defaults command, i.e.
defaults write com.apple.finder AppleShowAllFiles -bool yes
However, in order to make the changes take effect, you must quit and relaunch the target app:
osascript -e 'tell app "Finder" to quit'
When the Finder is quit like this (rather than using the
killall command, as some published sources advise), it saves and restores its window placements and disk locations (but not the forward-and-back history associated with each window). Is there some way to make such changes take effect immediately, without quitting the target app? After all, when you make changes in the Dock preference panel, they take effect instantly in the Dock application. Is there some Apple Event that I can send to make the change or make the app reread its prefs?