How to Shutdown and Reboot Linux PC automatically

A quick tip on how to shutdown your GNU Linux computer automatically,

Suppose you need your Linux pc to shutdown automatically at certain time, you can use this command line :

shutdown -hP 23:55

which instructs your box to power down at exactly 11:55 pm. The ‘h’ parameter instructs the program to halt the computer (init runlevel 6) and ‘P’ instructs it to power off the pc.

Note: You can also add an optional message and 20 seconds shutdown delay,

shutdown -hP 23:55 -t 20 Going to power down, let's call it a day

the delay is useful for you to finish off whatever you’re doing before the pc powers down.

Why do I use this command ?
Recently the doctor diagnose me with low blood pressure and advised me to sleep early and to eat more stuff that contains iron. So by using this command I can limit my online pc time, and let me sleep early.

I’ll show you how to shutdown your computer using countdown timer.

Here’s an example how you can shutdown your pc in one hour with 30 second delay between final warning and the actual shutdown.

shutdown -hP -t 30 60 Please save your work, the lab is going to be closed soon

you can use this command to reboot your computer too,

shutdown -r

Note that you need to have root access in order to use this command. That’s all for now, enjoy the holiday

[tags]shutdown,bash,linux,command line, gnu/linux, debian[/tags]

3 Replies to “How to Shutdown and Reboot Linux PC automatically”

Comments are closed.