Linux, OpenSource, Programming And Hacks

Sep 18, 2012

Commands for Automatic Shutdown in Ubuntu/Linux

Sep 18, 2012

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.

1. Any of these commands will Shutdown your System immediately

$ 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 

1 comment:

  1. sudo halt doesn't really shutdown the computer. It is working like the old AT-baby motherboard. sudo halt is the command to forget