How to schedule your Unix / Linux system to shutdown or reboot

In Linux, only the superuser is allowed to shutdown or reboot the system, unless some special settings have been made.

How to shutdown or reboot your Linux station:

The command for shutdown/reboot is called “shutdown” and can be scheduled:
You can ask your computer to shut itself down (or reboot) at 20:00, for example, or in 15 minutes from this moment:

shutdown -r is for restart, and shutdown -h is for power off.

Shutdown or reboot NOW:
$ sudo shutdown -h now OR $ sudo shutdown -r now

Shutdown or reboot in 10 minutes:
$ sudo shutdown -h +10 OR $ sudo shutdown -r +10

Shutdown or reboot at 20:00 o’clock:
$ sudo shutdown -h 20:00 OR $ sudo shutdown -r 20:00

You can also use the command reboot, halt or poweroff to restart your Linux system.

In Debian/Ubuntu/Linux Mint, halt and poweroff are symbolic links to /sbin/reboot:

$ ls -l /sbin/{halt,poweroff}
lrwxrwxrwx 1 root root 6 2012-05-21 22:38 /sbin/halt -> reboot
lrwxrwxrwx 1 root root 6 2012-05-21 22:38 /sbin/poweroff -> reboot

Be carefull not to be connected on ssh and by mistake shutdown the remote server instead of your local station!!! I recommand using Molly-Guard to protect your system from unwanted shutdowns. Read more about Molly-Guard here.

Liked it? Take a second to support Geekster on Patreon!
Tagged with: , , , , , , , ,
Posted in The Linux and Unix Articles!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Support LinuxG via Patreon
Support LinuxG.net on Patreon!
Subscribe

  

Subscribe to get the latest Linux news and how to guides directly on your e-mail!