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.
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.
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.
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.
Note: See our article for additional Linux shutdown command options.
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 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 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.
Next you should also read
How to use Linux Shutdown Command with Examples
July 5, 2020
The shutdown command is used to shut down the system immediately, schedule a shutdown, inform users of such…
Linux Commands Cheat Sheet: With Examples
February 21, 2020
A list of all the important Linux commands in one place. Find the command you need, whenever you need it or…
How to Start, Stop, and Restart Services in Linux
December 6, 2019
In most modern Linux operating systems, managing a service is quite simple when it comes to basic commands.…
How to Check Memory Usage in Linux, 5 Simple Commands
June 18, 2019
In this tutorial, learn the five most commonly used commands to check memory usage in Linux. We also provide…
Web Servers,SysAdmin,Bare Metal Servers
How to Restart Windows Server 2016 – Reboot Commands
October 22, 2018
When a computer runs for a long period of time, applications and operating system features can become…
Author
Sofija Simic
Sofija Simic is an aspiring Technical Writer at phoenixNAP. Alongside her educational background in teaching and writing, she has had a lifelong passion for information technology. She is committed to unscrambling confusing IT concepts and streamlining intricate software installations.