Open In App

How to Reboot Ubuntu through the Command Line

Last Updated : 16 Jun, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

A reboot is a process of restarting a working computer with hardware (such as a power button) rather than software. After installing a software package, installing operating system updates, recovering from an error, or re-initializing drivers or hardware devices, you may need to reboot. In this article, we will be rebooting the Ubuntu machine through the command line. There are multiple ways for rebooting the system, so will explore each of the methods.

Reboot Ubuntu through Terminal

There are 4 methods for rebooting Ubuntu through Terminal. Let’s look at all the methods one by one.

Method 1: Using the Reboot Command

The below command will immediately reboot your Ubuntu operating system.

sudo reboot now

 

This will reboot your Ubuntu System.

sudo reboot

 

Method 2: Using the Shutdown Command

The shutdown command is used to shut down your system, but it can also be used to restart it if you provide the -r flag. Here’s how you’d use the command in this situation:

sudo shutdown -r

 

Additionally, the following command can be used to schedule a system reboot.

sudo shutdown -r +[timeInMinutes]

The following command, for example, will restart your machine after 20 minutes.

sudo shutdown -r +20

 

You can also program your machine to reboot at a specified time.

sudo shutdown -r HH:MM

For example, the following command will reboot my system at 8:20 pm.

sudo shutdown -r 20:20

 

For cancelling the shutdown command you can use the following command.

shutdown -c

Method 3: Using the init Command

‘/sbin/init’ is the first process that runs when the kernel is loaded in Linux. It means the process has a PID of 1. Initialization is referred to as init. In simple terms, init’s job is to create processes based on scripts written in the /etc/inittab file, which is a configuration file utilized by the initialization system. The init command control file is specified in /etc/inittab, which is the last stage in the kernel boot procedure.

The ‘init 6’ command brings the system to a halt and restarts it in the state specified in ‘/etc/inittab’.

sudo init 6

 

Use the below command to reboot Linux Ubuntu into a multiuser mode.

sudo init 2

 

Use the command: to reboot into a Single-User State (Runlevel S).

sudo init s

 

Method 4: Using the  Systemd command

Systemd is a system and service manager for Linux operating systems. It operates as an init system that starts up and maintains userspace services when started as the first process on boot (as PID 1).

Because Ubuntu is based on systemd, you can reboot your system using a systemd-specific command.

sudo systemctl reboot

 


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads