The shutdown command comes in handy if you want to shutdown or reboot your Mac at a specific time. Here are some of the examples. You should be a super user to use these commands.
sudo shutdown [options] when [message]
Some examples.
Shutdown immediately:
sudo shutdown -h now
Reboot immediately:
sudo shutdown -r now
Shutdown at 9 pm:
sudo shutdown -h 21:00
Shutdown in 5 minutes:
sudo shutdown -h +5
Restart immediately
sudo reboot
Shutdown immediately
sudo halt