How to Restart/Reboot a Linux Server

Introduction

Knowing how to restart a Linux server is crucial for routine maintenance, troubleshooting, and applying updates. It allows for the implementation of configuration changes, resolves performance issues, and frees up system resources tied up by different processes.

Regular restarts contribute to system health by preventing the accumulation of problems that arise from continuous uptime.

This guide teaches you how to restart/reboot a Linux server.

How to Restart/Reboot Linux Server

Prerequisites

  • A Linux operating system (this tutorial uses Ubuntu 22.04).
  • Access to the Terminal.
  • Root or sudo privileges.
  • SSH software package (for some examples).

Restart Linux Server via the reboot Command

The basic command for restarting Linux is reboot. Depending on the system, sudo or root permissions may be required to execute this command.

Step 1: Open Terminal

The most popular way to manage your Linux system is via the terminal. These two methods are the easiest ways to open a terminal window:

  • The keyboard shortcut. Press Ctrl + Alt + T simultaneously on your keyboard to open the Terminal application.
  • Applications menu. Open the applications menu, search for "Terminal," and click the icon to open the application.
Terminal app in the Ubuntu applications menu.

To open the terminal on a remote server, use the ssh command to connect to it. The syntax is:

ssh [username]@[your_server_ip]

Replace username with your username and your_server_ip with your server's IP address or hostname.

Step 2: Use reboot Command

Once you open the terminal, use the reboot command to restart the server. In most cases, users need sudo privileges to use this command and restart a Linux server:

sudo reboot
Terminal output for sudo reboot

The command prompts for the user password to confirm the administrative privileges before initiating the system restart. For some accounts, sudo privileges are not necessary

Step 3: Wait for Reboot to Complete

Once you issue the command, the system restarts. The screen goes blank, and you see different messages or errors, if any. Then, the operating system logo appears, and the machine boots back up.

The time a Linux server takes to reboot depends on multiple factors, including the installed hardware or assigned resources if you are using a VM.

Restart Linux Server via the shutdown Command

The shutdown command is a common and efficient way to initiate a reboot. It instructs the system to restart by specifying the -r option.

Run the shutdown command with the argument -r now to restart the Linux server immediately:

sudo shutdown -r now
Terminal output for sudo shutdown -r now

Note: If you want to schedule a restart for a later time, replace now with a specific time in the format hh:mm.

Since the command requires sudo, type in the password when prompted. The command has no output.

Restart Linux Server via init Command

Using the init command to restart a Linux server is an older method, and it's mostly replaced with systemctl or reboot commands.

However, SysVinit system users may still want to restart the server using the init command:

sudo init 6
sudo init 6 terminal output

The init 6 command is traditionally used to trigger a system reboot. It is a runlevel defined in the SysVinit system, where runlevel 6 corresponds to a reboot.

Next, provide the password when prompted:

sudo init 6 password terminal output

Wait for the server to complete the restart process. The command leaves no output, but it does restart the system.

Restart Linux Server via systemctl Command

Systemd, the system and service manager in many modern Linux distributions, is designed to provide a high degree of control and flexibility. The systemctl command allows administrators to manage services, view their status, start or stop them, and restart them individually.

Note: To restart a Linux server using the systemctl command, you need sudo or root privileges.

To reboot Linux, use the following command

sudo systemctl reboot
Terminal output for sudo systemctl reboot

The command prompts for a password before restarting. Since this command requires sudo privileges, provide the password when prompted and hit Enter.

The command has no output but initiates the restart process for the entire system. The process takes up to a few minutes.

Conclusion

After reading this tutorial, you now know how to restart the Linux server using multiple methods.

Next, learn how to start, stop, and restart services in Linux.

Was this article helpful?
YesNo
Sara Zivanov
Sara Zivanov is a technical writer at phoenixNAP who is passionate about making high-tech concepts accessible to everyone. Her experience as a content writer and her background in Engineering and Project Management allows her to streamline complex processes and make them user-friendly through her content.
Next you should read
Linux Commands Cheat Sheet: With Examples
November 2, 2023

A list of all the important Linux commands in one place. Find the command you need, whenever you need it or...
Read more
How to Start, Stop, and Restart Services in Linux
March 27, 2024

In most modern Linux operating systems, managing a service is quite simple when it comes to basic commands...
Read more
How to Check Memory Usage in Linux, 5 Simple Commands
March 28, 2024

In this tutorial, learn the five most commonly used commands to check memory usage in Linux. We also provide...
Read more
How to Restart Windows Server 2016 Reboot Commands
January 15, 2024

When a computer runs for a long period of time, applications and operating system features can become...
Read more