Showing posts with label Shutdown. Show all posts
Showing posts with label Shutdown. Show all posts

Friday, December 25, 2009

Schedule a delayed shutdown

Several times I've initiated a download of a big movie file late at night before I go to bed.  Without knowing anything else, I'd normally have to leave my computer on all night just so that I could download that movie file that will probably only take up 3 hours.  Wouldn't it be nice if you could tell your computer to turn off after the time it takes to download something?

That's where the shutdown command in bash comes in handy!  Here's an example of the way I usually use it:

sudo shutdown -P 300

Firstly, you need to have root access to use shutdown, hence my use of the sudo command.  I used -P to indicate that I want to power off after shutdown (as opposed to rebooting, or 'halting').  Finally, I typed 300 to indicate that I want the computer to shutdown in 3.5 hours (300 minutes).

Another way you can use the command is by specifying the clock time at which you want your computer to shutdown in 24 hour format.  So let's say you want your computer to shut down at 4:15pm:

sudo shutdown -P 16:15

Type that in and your computer will shut down at 4:15pm.  That's it!