This brief tutorial shows students and new users how to reboot | restart Ubuntu from the command line using the systemctl or shutdown commands.
For students or new users looking for a Linux system to start learning on, the easiest place to start is Ubuntu Linux OS. It’s a great Linux operating system for beginners.
Ubuntu is an open-source Linux operating system that runs on desktops, laptops, servers, and other devices.
Both Ubuntu and Windows systems allow you to be productive, easy to use, and reliable and enable you to install and run thousands of programs, from gaming to productivity suite software for individuals and businesses.
Restart or Reboot using systemctl Command
Newer Linux systems, including Ubuntu, are using systemctl command to manage different tasks. You can use it to change the system’s hostname, set up time zone, and many more.
So, using the systemctl command you can reboot or restart Ubuntu by running the commands below:
sudo systemctl reboot
When you run the command above, the system will initial reboot immediately.
Logged-in users will be notified that the system is going to shut down, and the system’s services that are running will begin to stop processing.
You can add command options if you don’t want users to be notified or send custom shutdown messages.
To prevent user notifications, run the reboot command with the –no-wall option.
sudo systemctl --no-wall reboot
The command above will shut down the system without notifying any logged-in users.
If you want to send a custom message that the system is going down for a particular reason, run the command with the –message=”” option:
sudo systemctl --message="System Maintenance" reboot
The commands above will display a message to all logged-in users that the system is going reboot with a message that reads:
This is how to reboot Ubuntu
Reboot | Restart using the shutdown Command
You can accomplish the same goals as above using the shutdown command. The shutdown command is the oldest way to shut down or reboot Linux systems, including Ubuntu.
To reboot Ubuntu using the shutdown command, run the command with the -r option:
sudo shutdown -r
The -r option tells the command to reboot.
By default, the system will reboot after 1 minute. However, it can use other command options to specify how long to wait before rebooting the system.
For example, to reboot the system after 5 mins, run the commands below:
sudo shutdown -r +5
That will reboot the system after 5 mins.
To specify an exact time to reboot, use the format hh: mm for hours and minutes.
For example, shutdown at 11:15 am, run the command below
sudo shutdown -r 11:15
To immediately shut down the system without waiting, run the commands with the new option:
sudo shutdown now
That will start the shutdown immediately!
If you scheduled a shutdown and want to cancel, run the command with option -c
sudo shutdown -c "Canceling scheduled reboot"
That’s it! This is how one can reboot using the system from the command line.
Congratulations! you have learned how to reboot the Ubuntu system from the command line using the systemctl and shutdown commands.