In this tutorial, we will show you a couple of ways to reboot a Linux system.
This guide will cover several commands you can use to restart your Linux systems using the terminal.
Rebooting Linux is a straightforward process and can be done using some very simple commands. The commands we will cover should work on most Linux distributions, including Ubuntu and Debian.
We won’t be covering how to use the desktop interface to restart your system since this can differ hugely depending on your Linux flavor.
Please note to restart your device using the terminal. You will need to have super user privileges.
Using the Reboot Command on Linux
The fastest and easiest way to restart a Linux system is to use the reboot command. This command is super simple to use and is basically a shortcut to one of the shutdown command’s options.
Reboot is the equivalent of utilizing the “shutdown -r now
” command.
1. Before beginning, you can open the terminal on a system with a desktop by pressing CTRL + ALT + T on your keyboard.
If you are using a command line only system, you can safely skip to the next step.
2. Now that you have the terminal open, you can now utilize the reboot command on Linux to restart the system.
This command is simply used by using “sudo
” followed by “reboot
“.
sudo reboot
Please note, if you are using the root user, you do not need to use “sudo
” in front of “reboot
“.
3. Your system should immediately restart after running this command unless an application is blocking the restart process.
There are various reasons this might happen, such as a runaway process.
4. If an application stops your system from restarting, you can force the reboot. Be careful when doing this, as Linux will not wait for any application to safely quit leading to potential data loss or corruption.
To force a reboot on Linux, you can use the “--force
” flag alongside the reboot command, as shown below.
sudo reboot --force
Rebooting Linux using the Shutdown Command
You can also use the Linux shutdown command to reboot a Linux system by passing in the correct options.
Using this command gives you a little bit more fine control over when the restart will occur. For example, you can schedule a reboot after 10 minutes have passed
1. The most straightforward way to use the shutdown command to reboot a Linux system is the following.
All you need to do is use “sudo
“, followed by “shutdown
“, and finally the “-r
” option.
sudo shutdown -r
Using the shutdown command this way the system will schedule a restart 1 minute from when you ran the command.
2. You can also control when exactly a reboot is executed using this command. You do this by including the time in minutes after the “-r
” option.
For example, if we want to reboot our Linux system 20 minutes from now, we can use the following.
sudo shutdown -r +20
3. Of course, if you don’t want to wait for your system to restart, you can use the “now
” keyword instead of the time in minutes.
Below is the command you will want to use to reboot your Linux system immediately.
sudo shutdown -r now
Using sytemctl to Reboot your Linux Device
The last way of rebooting Linux that we will be going into is utilizing the “systemctl” command within the terminal.
In systems that utilize systemd to manage its various systems, including services, you can use systemctl to reboot the system.
Most modern Linux distributions have switched to using systemd to manage the system. These modern systems include Ubuntu, Debian, CentOS, RHEL, and more.
1. To reboot Linux using systemctl, all you need to do is use the following command
sudo systemctl reboot
2. After running the above command, your system should immediately reboot. The system will stop any running processes, and any open files will be closed.
Conclusion
Throughout this tutorial, we have shown you a few different commands you can use to reboot your Linux device.
Restarting Linux is a straightforward process and can be done with straightforward commands in the terminal.
Please comment below if you have any issues with getting your system to reboot.
We have many other helpful Linux guides worth checking out if you want to learn more.