Set Your Mac’s Sleep Time Using Terminal Command
Terminal commands are great for controlling a remote computer, scripting, or automating your computer . Here is a handy terminal command that allows you to set the sleep delay and override the system settings.
If you are at your computer, changing the system settings for sleep mode is easy. But if, for example, you are giving a presentation, you can include this command in your workflow. To set a timer for 60 minutes, use the following command:
sudo systemsetup -setcomputersleep 60
If you want the computer not to go to sleep, put NEVER at the end of the command:
sudo systemsetup -setcomputersleep Never
Set or Disable Mac Inactivity from the Command Prompt in OS X | OS X Daily