Skip to main content
Basics

Restart Ubuntu System From Command Line

Here are a few ways to restart an Ubuntu server from the command line. You can reboot it immediately or schedule one at a later time.

Abhishek

Want to restart an Ubuntu server from the command line?

While there are multiple ways to achieve that, look no further than:

reboot now

This will instantly start the reboot process for your server. I always use it whenever I have to restart my Ubuntu servers hosted on Linode or CloudOcean.

Let's see things in a bit more detail.

🙌
You need to be root or use sudo with these commands to restart the system.

Rebooting Ubuntu from the terminal instantly

The simplest way is to use the reboot command to restart your Ubuntu system from the command line:

reboot

Sometimes it gives you one minute of buffer time. But on some systems, it starts the reboot procedure immediately.

If you don't want to worry about that, use the now option:

reboot now

This is the simplest option that works pretty well with a system on which you are the sole user.

But on a system with other users, using the shutdown will be more appropriate.

Learn Linux Quickly - Linux Commands for Beginners
Learn Linux Quickly doesn’t assume any prior Linux knowledge, which makes it a perfect fit for beginners. Nevertheless, intermediate and advanced Linux users will still find this book very useful as it goes through a wide range of topics. Learn Linux Quickly will teach you the following topics:Insta…

Schedule a reboot with shutdown command in Ubuntu

You can also use the shutdown command with option -r to restart the system.

sudo shutdown -r

This will schedule a shutdown in one minute.

root@learnubuntu:~# shutdown -r
Reboot scheduled for Mon 2022-07-25 15:13:31 UTC, use 'shutdown -c' to cancel.

If there are other users logged on to the server, they will receive a message about the scheduled reboot:

Broadcast message from root@learnubuntu on pts/0 (Mon 2022-07-25 15:12:31 UTC):

The system is going down for reboot at Mon 2022-07-25 15:13:31 UTC!

You can change the reboot schedule by delaying it for certain minutes to certain hours.

To restart the server automatically after 30 minutes from now, use:

sudo shutdown -r +30

To restart the server automatically at 20:00 hours (in local system time):

sudo shutdown -r 20:00

It will inform you about the scheduled reboot:

root@learnubuntu:~# shutdown -r 20:00
Reboot scheduled for Mon 2022-07-25 20:00:00 UTC, use 'shutdown -c' to cancel.

You can cancel a scheduled reboot or shutdown with the following command:

sudo shutdown -c

Bonus tip: Use systemd command

Considering that Ubuntu uses systemd, you can use the systemctl command to restart Linux machine:

sudo systemctl reboot

I am not a fan of the systemctl command. I prefer the reboot or shutdown commands for restarting my Ubuntu servers.