HOWTO shutdown and reboot from the command-line
Linux has several commands to turn of the computer.
The old-fashioned way
The old-school way of powering off a machine is to use the
shutdown command. It takes several arguments. The most common is
-h now to order a
<code<shutdown -h now
There's also two commands that do not need any arguments. These are
poweroff. These are actually symbolic links to
systemctl on most modern machines.
'Rebooting can be also be done with the
shutdown command by using the
shutdown -r now
There is also a command called
reboot which is actually a symbolic link to
systemctrl on modern distributions.
These commands require you to be root which means you need to run them as root or use sudo.
The systemd way
systemd's control tool
systemctl takes the following arguments:
halt, poweroff, reboot, kexec, suspend, hibernate, hybrid-sleep, suspend-then-hibernate, default, rescue, emergency
systemctl does not require you to be root and will happily reboot or halt the machine when a user runs these commands. (unless the configuration file
/etc/systemd/logind.conf is configured to prevent this, which it's not by default). As a normal user you can reboot by running:
and you can shutdown by running
An interesting option to use with systemctl's reboot parameter is
--firmware-setup which will take you directly to the machines BIOS ("firmware setup") upon reboot:
systemctl --firmware-setup reboot