How to Restart or Reboot Linux Server from the Command Line

Introduction

Restarting or rebooting a Linux server from the command line is a simple process that can be done in a few steps. It is important to understand the difference between a restart and a reboot. A restart will close all running programs and services, but will not shut down the system. A reboot will completely shut down the system and restart it. Knowing the difference between the two is important when deciding which one to use. This guide will provide step-by-step instructions on how to restart or reboot a Linux server from the command line.

How to Restart or Reboot Linux Server from the Command Line

1. Reboot the System

The most common way to reboot a Linux server is to use the reboot command. This command will immediately reboot the system, without giving you a chance to do anything else.

To reboot the system, open a terminal window and type the following command:

sudo reboot

2. Shutdown the System

If you want to shut down the system instead of rebooting it, you can use the shutdown command. This command will shut down the system, but it will give you a chance to do other tasks before the system shuts down.

To shut down the system, open a terminal window and type the following command:

sudo shutdown -h now

3. Halt the System

If you want to halt the system instead of rebooting or shutting it down, you can use the halt command. This command will immediately halt the system, without giving you a chance to do anything else.

To halt the system, open a terminal window and type the following command:

sudo halt

Introduction

It’s a cliché, but true – restarting a Linux server solves a wide variety of issues.

When a system is rebooted, any malfunctioning software is purged from active memory. When the system restarts, it loads a fresh, clean copy of the software into active memory. Also, some operating systems require a restart to process updates or configuration changes.

This guide will show you how to restart a Linux server using only the command-line or prompt.

restart or reboot linux server from the command line

Prerequisites

  • A system running a Linux operating system
  • Access to a command-line interface (also known as a terminal)
  • Root or sudo privileges
  • (optional) SSH software package for communicating with a remote server

Steps to Restart Linux using Command Prompt

Restarting Local Linux Operating System

Step 1: Open Terminal Window

If your version of Linux uses a graphical interface, you can open a terminal window by right-clicking the Desktop > left-clicking Open in terminal.

open terminal window in linux

You can also click the main menu (usually found in the lower-left or upper-left corner) and type in terminal in the search bar. Click on the Terminal icon, as in the image below.

search for terminal window in ubuntu

Step 2: Use the shutdown Command

Since powering off is one of the most basic functions of an operating system, this command should work for most distributions of Linux.

In a terminal window, type the following:

sudo shutdown -r

The sudo command tells Linux to run the command as an administrator, so you may need to type your password. The -r switch at the end indicates that you want the machine to restart.

Alternative Option: Restart Linux with reboot Command

In the terminal, type:

reboot

Many Linux versions do not require administrator privileges to reboot. If you get a message that you do not have sufficient privileges, type:

sudo reboot

Your system should close out of all open applications and restart.

Reboot Remote Linux Server

Step 1: Open Command Prompt

If you have a graphical interface, open the terminal by right-clicking the Desktop > left-clicking Open in terminal.

You can also click the main menu (usually found in the lower-left or upper-left corner), and then click Applications > System Tools > Terminal.

If you prefer using a keyboard shortcut, press Ctrl+Alt+T.

Step 2: Use SSH Connection Issue reboot Command

In a terminal window, type:

ssh -t [email protected] 'sudo reboot'

Note: You may need to enter the password for the username you’ve used. Also, make sure you type the single-quote marks.

The ssh command tells your system to connect to another machine. The -t option forces the remote system to enter the command in a terminal. Replace [email protected] with the username @ server name that you want to restart.

The sudo reboot command can be switched out for sudo shutdown and the above options above can be used.

That is: -r tells it to restart, hh:mm sets a specific time, +mm sets a countdown.)

Conclusion

In this tutorial, you have learned how to restart a Linux server from the command prompt.

Rebooting a Linux system or server is designed to be simple, so you shouldn’t have any trouble. Just make sure you have saved all your work before restarting.

How to Restart or Reboot Linux Server from the Command Line

Restarting or rebooting a Linux server from the command line is a straightforward process. It is important to understand the different commands available and when to use them. This article will explain the different commands and how to use them.

Shutdown Command

The shutdown command is used to shut down the system. It can be used to shut down the system immediately or at a specified time. To shut down the system immediately, use the following command:

shutdown -h now

To shut down the system at a specified time, use the following command:

shutdown -h hh:mm

Where hh:mm is the time in 24-hour format.

Reboot Command

The reboot command is used to reboot the system. It can be used to reboot the system immediately or at a specified time. To reboot the system immediately, use the following command:

reboot

To reboot the system at a specified time, use the following command:

shutdown -r hh:mm

Where hh:mm is the time in 24-hour format.

Conclusion

Restarting or rebooting a Linux server from the command line is a straightforward process. It is important to understand the different commands available and when to use them. This article has explained the different commands and how to use them.

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

Contact
San Vito Al Tagliamento 33078
Pordenone Italy
Item added to cart.
0 items - 0.00
Open chat
Scan the code
Hello 👋
Can we help you?