Introduction

There is a reason that tech support asks you if you have rebooted your server. It’s clichéd, 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.

how to 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 usually open a terminal window by right-clicking the Desktop > left-clicking Open in terminal.

open terminal window in linux

Alternately, you can 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.

open 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 the terminal, type:

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 on the end indicates that you want the machine to restart.


Note: If you leave the -r switch off, your system will only shut down. You need to manually power back up.


Other Linux shutdown Commands

You can use the shutdown command with different switches to control its behavior.

To shut down completely, right now:

sudo shutdown –h now

To tell your computer to reboot in 30 minutes:

sudo shutdown -r +30

You can also tell your system to reboot at a certain time:

sudo shutdown –r 16:45

Note: Use the 24-hour format to enter your desired time.


Restart Linux Without Admin

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.

Alternately, you can 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 user@server.com ‘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 user@server.com 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 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. Make sure you have saved all your work before you hit Enter.