How to make Linux shut down automatically at a time programmed by the terminal

Today you will learn a very simple tip to use but it can be very useful at various times.

Shutting down Linux automatically

How to set Linux to shut down automatically

Recently I had to schedule the shutdown of my computer because I wanted to let him update the game on Steam while leaving home to work, but I would come back very late this day and the update would last a maximum of two hours. How to Save Electricity Something very important I thought it would be good to schedule the system shutdown for a short time after two hours have elapsed under warranty.

This way I remembered a program called qShutdownwhich I made a post talking about here on the blog a long time ago, this post you can read clicking here.

But as I know the power of the Linux terminal I thought, "There must be some way to do this for the terminal …" and what?

Quite simple to do on top of that, let's go!

Shutting down your computer through the terminal

The really simple process, open your ends and type the following command:

sudo shutdown -h +XX

In this case the XX represents the time in minutes that the computer should shut down from the current time. For example: sudo shutdown -h +90 would cause the computer to stay on for ninety minutes more from the moment the command was given.

or

sudo shutdown -h XX: XX

This second case is a bit more specific, in which you can define exactly what time you want the computer to turn off, the time should be informed in 24 hour format, in this case the XX: XX represent the hours and minutes.

For example: sudo shutdown -h 16:30 this causes the computer to shut down 4:30 pm, also known as four thirty in the afternoon.

Canceling shutdown

If you have mistaken the time to set the time or shutdown time do not worry, cancel the process very simple, just use the shortcut key Ctrl + C or simply close the terminal by terminating the process.

See you next time!

_____________________________________________________________________________ See any errors or would you like to add any suggestions to this article? Collaborate, click here.