There are times when you need to Schedule shutdown of your computer Maybe when you are downloading some large file or you listen to music before before going to sleep and would like to be able to shutdown your computer after a specified amount of time. After 30 mins say. These simple Terminal commands will Shutdown/Restart your computer at a specific time interval.
$ sudo shutdown -h now
$ sudo halt
$ sudo poweroff
2. These will Restart your Computer immediately
$ sudo shutdown -r now
$ sudo shutdown -r 0
$ sudo reboot
3. This Command will Shutdown the System in 5 Minutes. You can set any Time of your Choice
$ sudo shutdown -h 5
4. Enter this to shutdown computer at a specific time
$ sudo shutdown -h 18:45
Enter Ctrl + C to stop the shutdown process/any ongoing process in the terminal. In some cases shutdown -c will work
put -r instead of -h in the above commands in case you want to restart
sudo halt doesn't really shutdown the computer. It is working like the old AT-baby motherboard. sudo halt is the command to forget