There are some times when you need to turn automatically your PC off, there can be a lot of examples when this is necessary.

I usually do this when I left some torrent downloading, let’s say some Linux isos to test a new Linux distribution, so I leave my PC downloading the ISO at office over the weekend, and program my PC to turn of, some two or three hours after the estimated time when the download is suppose do finish.

I do not have too much bandwidth so a whole DVD can take some 26 hours downloading. Specially because I limit the usages of bandwidth to 50% of the available to leave room for other tasks.

Well, let’s see how to do it.

sudo shutdown -h -P [hour]:[minutes]

This is only useful, if you need to shutdown the computer on the same day you are, or the next one, let’s suppose it is noon, and you want to shutdown your computer at 17 hours.

sudo shutdown -h -P 17:00

But if you need to shutdown your computer the day after tomorrow, or even later, use this commands.

sleep 2d 3h | poweroff

You need to run that command as root, or using sudo, but you need to be in the sudoers file, and not required to enter passwords.

That command is going to shutdown the computer after 2 days and 3 hours from now

I am sure there are some other ways to program the shutdown of a Linux computer, and I will be glad if you can post alternatives in the comments.