A nice tip from Lifehacker: if you want your Mac to stay awake, no matter what, pop open a terminal and type
and when you’re happy to let your machine sleep when it feels like it, hit Ctrl + C.
pmset lets you tinker with various power management, wake, sleep and hibernation settings (it’s essentially the CLI equivalent of the Energy Saver pane of System Preferences).
Want your Mac to wake up at 8am on the 26th of February, 2011?
pmset schedule wake "02/26/11 08:00:00"
Need the display to sleep after five minutes of inactivity when you’re on battery power?
pmset -b displaysleep 5
Curious about your current power settings, but can’t be bothered opening System Preferences?