How can I enable and/or disable OS X's power nap feature from within Terminal?

Use pmset to change the darkwakes parameter:

sudo pmset -c darkwakes 1

The darkwakes parameter is not mentioned in the man page, but it is shown by pmset -g if your Mac supports Power Nap and is operating on an AC power.

-c is AC power (or charger or wall power), -b is battery power, -u is UPS, and -a is all.

You can also edit the plist directly, but you have to restart to apply the changes:

sudo /usr/libexec/PlistBuddy -c 'Set "Custom Profile":"AC Power":DarkWakeBackgroundTasks 1' \
    /Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plist

Or using sed:

sudo sed -i '' '/DarkWakeBackgroundTasks/{N;s/false/true/;}' \
    /Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plist

OS X: About Power Nap The following Mac computers can use Power Nap. Some of these computers may require an SMC update in order to use this feature.

http://support.apple.com/en-us/HT5394


It seems the more clearly named powernap option has replaced darkwakes, which is also now documented in the pmset man page. Its usage is similar e.g to disable (0) it for all (-a) power sources:

sudo pmset -a powernap 0

However it seems that, according to the latest pmset source code, for the time being either option will work.