How to Restart Ubuntu using the Terminal

In this tutorial, we will be showing you how you can restart Ubuntu using the terminal.

How to restart Ubuntu

Knowing how to reboot Ubuntu is one of those simple but crucial to know tasks for managing your system.

There are numerous reasons why you need to reboot Ubuntu. An example of a reason you would want to restart is if you changed the size of the system’s swap. Unfortunately, applications aren’t aware of changes to the swap till they are restarted.

Another reason you may want to update the terminal is if you updated your Ubuntu kernel, it won’t be utilized until the system is rebooted.

Over the following few sections, we will cover three commands you can use to restart your system.

If you are using a desktop variant of Ubuntu, you can perform any of these commands by opening the terminal. You can open the terminal easily by pressing CTRL + ALT + T.

Restarting Ubuntu using the reboot Command

The reboot command is the simplest way to restart Ubuntu within the terminal. This command is simple to remember and doesn’t require any extra arguments to execute a restart.

As this command is a core part of Linux, it should work on any Linux-based system.

All you need to do is “reboot” within the terminal as shown below.

reboot

Since you need superuser privileges to restart Ubuntu, you may be required to include “sudo” in front of the command.

sudo reboot

If your Ubuntu device refuses to restart after running the reboot command, you can force it. However, forcing a restart does come with the caveat that you could end up with data loss.

This is because it will kill all processes without giving them a chance to stop gracefully.

You can force a restart on Ubuntu by using the following command within the terminal.

sudo reboot --force

Using the shutdown Command to Restart Ubuntu

Despite its name, you can also use the shutdown command to restart the Ubuntu operating system. While this command isn’t as straightforward to use as reboot, it is still incredibly simple.

One of the reasons you might want to use this command over reboot is that you can schedule when this restart will occur.

The simplest way to utilize this command is to use “shutdown” followed by the “-r” or "--reboot” arguments. When using the command, your device will be rebooted 1 minute from when you ran the command.

sudo shutdown -r

Alternatively, if you wanted to specify how many minutes should pass before your Ubuntu device is restarted, you could use the following.

Just ensure that you replace “MINUTES” with the number of minutes you want to be passed before the reboot occurs.

sudo shutdown -r +MINUTES

For example, you would use the following command to restart Ubuntu in 30 minutes.

sudo shutdown -r +30

Like with the reboot command, you can restart Ubuntu immediately by writing “now” in the place where you would specify the time.

sudo shutdown -r now

One of the advantages of using the shutdown command to perform a restart is its delayed restarts.

As shown below, it is possible to cancel any pending restarts using the “-c” option alongside shutdown.

sudo shutdown -c

Using systemctl to Restart Ubuntu

It is also possible to use systemctl to restart your Ubuntu device. This is the tool you may be familiar with for managing services running on Ubuntu.

Since this tool talks with systemd, the system that manages the system and services, you can also use it to restart the device.

To restart Ubuntu using systemctl, all you need to do is type the following into the terminal

sudo systemctl reboot

When using this command, the restart will occur immediately. There will be no delay.

Conclusion

Throughout this guide, we have shown you three different commands to restart the Ubuntu operating system.

Please comment below if you have questions about using the terminal to restart your device.

We have plenty of other Ubuntu tutorials and projects worth checking out.

Leave a Reply

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