The Wayback Machine - https://web.archive.org/web/20240910020804/https://www.geeksforgeeks.org/how-to-reboot-ubuntu-through-the-command-line/
Open In App

How to Reboot Ubuntu through the Command Line

Last Updated : 16 Jun, 2022
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

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

 



Similar Reads

Reboot Linux System Command with Examples
Rebooting a Linux system is a fundamental administrative task necessary for applying updates, troubleshooting, or system maintenance. Various commands are available to reboot a Linux system, each with specific options and use cases. This guide explores essential reboot commands such as `reboot`, `shutdown`, and `init`, illustrating their usage with
11 min read
How to Compare Files Line by Line in Linux | diff Command
In the world of Linux, managing and comparing files is a common task for system administrators and developers alike. The ability to compare files line by line is crucial for identifying differences, debugging code, and ensuring the integrity of data. One powerful tool that facilitates this process is the diff command. In this article, we will explo
9 min read
halt, poweroff and reboot Commands in Linux
Below are typical uses of halt, poweroff and reboot. halt : Instructs hardware to stop CPU functions. poweroff : Instructs the system to power down. reboot : Restarts or reboots the system. The above mentioned commands can only be run by super user as these involve the actions to stop the system hardware. If the user is not logged in as super user
2 min read
Ksplice Install Linux Kernel Updates without Reboot
The Ksplice software allows changes/patches to be made to the running kernel without the need for any reboot. Important patches are made while the system is still running and there is no need to restart the computer. The software was acquired by Oracle in 2011 and is also known as the Oracle Ksplice. Why do systems need to reboot in the first place
7 min read
How to use the whois command on Ubuntu Linux
Whois is a command-line utility used in Linux systems to retrieve information about domain names, IP addresses, and network devices registered with the Internet Corporation for Assigned Names and Numbers (ICANN). The data received by Whois consists of the name and contact information of the domain or IP address owner, the registration and expiratio
3 min read
systemctl: command not found on ubuntu
In Ubuntu, while working with the systemctl command, users typically manage system services, view their status, start or stop them, and enable or disable them at system startup. However, encountering the "systemctl: command not found" error suggests that the systemctl utility is not available or accessible in the current environment. This issue com
3 min read
Ccat – Colorize Cat Command Output command in Linux with Examples
ccat is a command-line tool for Linux and OSX, which is similar to the cat command in Linux. But the difference between cat and ccat is that the ccat shows the content of the file with the syntax highlighted. Currently, ccat supports the following programming languages. JavaScriptJavaRubyPythonGoCJSONInstallation of Ccat First, we are going to see
2 min read
How to Display Command History in Linux | history Command
The command-line interface in Linux provides powerful tools for users, and mastering command history is essential for efficient navigation and retrieval of previously executed commands. The history command is a valuable utility that allows users to view and search through their command history. In this comprehensive guide, we will explore the vario
4 min read
How to Abort a Command Execution in Command Prompt?
When working in the Command Prompt, there are times when you need to halt a running command immediately. Understanding how to abort command execution in CMD can save you from potential issues and wasted time. In this guide, we'll explore various methods to stop commands, including using `Ctrl+C`, terminating processes, and other effective technique
5 min read
How to Install NuGet from Command Line on Linux?
NuGet is the package manager for the .NET framework. It's very much useful for developers as developers can create, publish and consume packages. The package format of NuGet consists of a single ZIP file with the extension of .nupkg and which is the DLL compiled code like the package’s version number. A NuGet package manager is a cross-platformed m
2 min read
Bash shell script to find out the largest value from given command line arguments
Write a shell script to find out the largest value from the given number of command-line arguments. Example: Special variables in bash: $@- All arguments. $#- Number of arguments. $0- Filename. $1, $2, $3, $4 ... - Specific arguments. Approach If the number of arguments is 0, end the program. If not zero, then Initialize a variable maxEle with firs
1 min read
Connecting to the Internet Using Command Line in Linux
Many of the times you may use a Linux system that does not have a GUI after install and it needs an internet connection to set up a desktop environment, also you may use Linux servers without a GUI and you need to connect over a wireless network using the command line. Below you will see Steps to connect to a wireless network using the command line
3 min read
Kali Linux - Command Line Essentials
Command-line plays a vital role while working with Kali Linux as most of its tools don't have a Graphical User Interface and if you are performing ethical hacking or penetration testing then most of the time you will have to work with command Line Interface itself. While executing a command in Kali Linux we enter a command on the terminal emulator
3 min read
Deepl - Command Line Language Translator Tool for Linux
Deepl is the best language translator command-line tool that detects the language of input text and translates it into the desired language using advanced machine learning and neural networking algorithms. It is open source and powered by a German tech Company under the MIT license. It supports the following languages English (EN)Italian (IT)Spanis
3 min read
How to Convert PDF to Image in Linux Command Line?
Pdftoppm is a tool that converts PDF document files into .PNG format and many other formats. We can use this tool on Linux to convert the PDF into images. It also provides the features like the cropping image, set resolution, and scale, and many more. Now let's see how to install the pdftoppm Installation of pdftoppm: To install the pdftoppm, we ne
3 min read
How to Install and Use Sysdig from Linux Command Line?
Sysdig is a tool that provides administrators and developers with unparalleled insight into their systems' behavior. The team behind it hopes to enhance system-level monitoring and troubleshooting by providing a centralized, coherent, and granular view of the storage, transmission, network, and memory subsystems, as well as the ability to generate
2 min read
Aria2 - Multi-Protocol Command-Line Download Tool for Linux
Aria2 is an open-source lightweight multi-protocol, multi-server & multi-source command-line utility that is used for downloading files in Windows, Linux, and Mac. Aria2 is used to download a file at a good speed by utilizing your maximum download bandwidth from multiple sources/protocols such as HTTP(S), FTP, SFTP, Bittorrent, and Metalink. Yo
4 min read
Optimize and Compress JPEG or PNG Images in Linux Command line
Today there are many GUI tools that compress and optimize the images, which are very useful. But if you are terminal addicted and want to compress and optimize the images in the terminal before uploading to the cloud, then you can do it. There are two tools by using which we can compress and optimize images. These are - jpegoptimOptiPNGjpegoptim jp
4 min read
GithubFind3r - Fast Command Line Repo/User/Commit Search Tool
GithubFind3r is an automated tool developed in Node JS which is a CLI-based tool used to get information about the Repositories, Commits, and information about the Users from GitHub. GithubFind3r is available on GitHub, it's free and open-source to use. The GithubFind3r tool displays the results in a more sophisticated and more attractive manner. N
2 min read
Bash Script - How to use Command Line Arguments
In this article, let us see about Command Line Arguments usage in Bash script. Arguments are inputs that are necessary to process the flow. Instead of getting input from a shell program or assigning it to the program, the arguments are passed in the execution part. Positional Parameters Command-line arguments are passed in the positional way i.e. i
4 min read
Top Linux Command Line Tips and Tricks
Linux is a great OS that offers multiple options for simplifying tasks. It has everything you need for working more efficiently, whether a command-line or a GUI. However, many people don't know the Linux command line's short tricks and end up being stuck in complex tasks. An interface (text-based) through which you communicate with your system's OS
5 min read
How to Install Git on Windows Command Line?
Git is an open-source and free, decentralized version control system designed to handle projects of all sizes with speed and efficiency. Basically, it is a software tracking application that is commonly used to monitor projects across several teams. The best way of downloading and installing Git on the windows command line is to download it from it
3 min read
Getting Started with Scala and sbt on the Command Line
Scala is a potent general-purpose programming language with structured query data types that supports both operational and object-oriented programming. Many of Scala's design decisions are intended to be brief and try to address Java's critics. In this article learn how to create a Scala project from a template in this lesson. This might serve as t
2 min read
How to Manage KVM Virtual Environment using Command Line Tools in Linux
KVM, short for Kernel-based Virtual Machine, is a complete virtualization solution for Linux running on x86 hardware (Intel VT or AMD-V). Since version 2.6.20, the mainline Linux kernel has featured KVM, a complete virtualization solution for Linux running on Intel 64 and AMD 64 hardware that is fast and stable for the majority of workloads. It con
8 min read
How to Pass Command Line Arguments to GDB in a Linux Environment?
The GNU Debugger, commonly known as GDB, is a powerful tool used for debugging and analyzing programs in Linux and other Unix-like operating systems. While GDB is commonly used to debug programs, it can also be used to launch programs with specific command line arguments. This article will walk you through the process of passing command line argume
6 min read
How to Print Second Command line Argument in shell?
Command line arguments are the parameters we pass to a command or script when we run it from the terminal. These arguments are passed as strings and can be accessed within your program to perform various operations. How to Print Second Command Line Argument in Shell?The shell stores the command line arguments in a positional way. The first argument
5 min read
Open Google Chrome From The Linux Command Line
Google Chrome is known as the most used and widely popular web browser because of its fast and better performance. In this article we will learn how we can open the Google Chrome application by using the terminal in Linux along with this we will also look at some you should command line switches to help you to start using the Google Chrome browser
6 min read
MySQL in Kali Linux Command Line
Below is a comprehensive MySQL Command Line tutorial for Kali Linux, starting from beginner to advanced levels. MySQL is a popular open-source relational database management system, and Kali Linux is a Debian-based Linux distribution often used for penetration testing and ethical hacking. Make sure you have MySQL installed on your Kali Linux system
10 min read
How to change time zone from command line on RHEL 9
Correctly setting the time zone on a Red Hat Enterprise Linux (RHEL) 9 system is crucial for ensuring accurate time synchronization and proper functioning of various applications and services. While graphical tools are available for configuring the time zone, administrators often prefer command-line methods for efficiency and automation. In this gu
4 min read
Uninstall Node.JS Using Linux Command Line
To uninstall Node.js from your Linux system using the command line, you can follow these steps. The specific commands may vary depending on your Linux distribution, so I'll provide instructions for a few common package managers: APT (Debian/Ubuntu), YUM (Red Hat/CentOS), and DNF (Fedora). Check if Node is Already Installed or NotEnter the following
3 min read