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.

# SYNTAX: sudo shutdown [options] when [message]

# 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