Home | About | Categories | All Tips & Tutorials

Shutdown Ubuntu and Ubuntu based distributions at a specific time or within (x) minutes

ID: 206

Category: Ubuntu

Added: 30th of October 2020

Views: 2,575

I never realised the shutdown command extended further, where you can specify a time to shutdown or shutdown the system in (x) amount of minutes.

To shutdown your system at a specific time, it must be entered the following format HH:MM
So to shutdown your system at Two Twenty PM in the afternoon we enter the following command

sudo shutdown 14:20

To shutdown your system after (x) amount of minutes, it must be entered in the following format +m

So to shutdown the system after 20 Minutes enter the following command
sudo shutdown +20

You can also add a message when the shutdown command is initiated, for example shutting down
sudo shutdown +20 "Shutting Down....."

To reboot your system at Ten PM in the evening we enter the following command
sudo shutdown -r 22:00 "Rebooting..."

You could create a cron job to reboot your system once a month, once a week, once a day and so on. Cron jobs are discussed in my other tutorial, which can be found here

To cancel a scheduled shutdown or reboot of your system, you can use the following command
sudo shutdown -c

Related Tips & Tutorials

Create a simple cronjob in Linux