Have you ever wondered how many ways you can restart a computer running Linux? Sure, there’s the obvious “click Shutdown and then reboot on the taskbar” thing, but the command line gives you access to other five different ways to reboot the PC. Let’s see what these are.
init is one of the oldest ways to reboot or shutdown a computer on Linux, dating back to the time of Unix. Of course, this is just part of what
init does. In actuality, it’s a very complex program that is always called first (it has a Process ID of 1) and performs all operations needed to get the computer to a useful state. To reboot your computer, type the command
sudo init 6
in a terminal and press Enter. You’ll be asked to enter your administrator password.
telinit is a smaller program that is used to “tell init” to switch runlevels. From a user’s perspective, however, both commands produce identical results. To restart the computer, type
sudo telinit 6
and press Enter. Type in your administrator password and press
shutdown is a more modern command than init and telinit that is used to shutdown, reboot or enter single-user mode. To reboot, type in the command
sudo shutdown -r now
, enter your administrator password when prompted, and press Enter.
-r switch tells the computer that it must reboot after it has completed closing all running processes and unmounting all volumes, whereas now is a variable with a value of 0 that tells the shutdown command to execute the command immediately (i.e., after 0 minutes).
From the user’s point of view, both
shutdown -r now and
reboot (or all the other commands we’ve discussed so far, for that matter) do exactly the same thing: they start the shutdown process and then reboot the computer. However,
reboot does not require you to specify a time. In normal circumstances
shutdown to perform all operations. It’s just a time-saver, really.
SystemCTL is part of SystemD, a brand-new init process that will eventually supplant init itself. Support for SystemD varies wildly among distributions. In the Linux community, the init vs systemd topic is very divisive, with proponents arguing that init was an old dragon that was due a slain, and detractors saying that it’s a buggy mess. Whatever the case may be, you can reboot your computer with the command
sudo systemctl reboot
Enter your password and press Enter.