How to restart the Ubuntu Server using command-line

Let's check out the ways to reboot your Ubuntu server using commands. They can also be executed remotely via SSH using applications like Putty. If you are running a desktop version of any Debian-based distribution, these commands can also come in handy.

Ubuntu server is growing popular every day. Thanks to containers and cloud computing. For small businesses and organizations looking for an affordable server solution, the Ubuntu server is the way to go. It works well with practically all hardware and virtualization platforms.

Currently, 37% of websites online run on Linux servers, and of that percentage, the Ubuntu server takes 35.9%. It wouldn’t be a surprise to realize that Ubuntu powers your website. Even Microsoft cloud platform Azure makes use of Ubuntu server images.

In this particular article, we are going to look at a few Ubuntu server terminal commands – how to restart the Ubuntu server via command-line. Most of the network administrators, engineers, or anybody managing an Ubuntu server, there is a high probability they don’t use the Graphical User Interface (GUI) utility. It’s either they execute commands directly on the server command-line or access it remotely via SSH using applications like Putty.

Restarting Ubuntu Server using command-line

We will be looking at all the commands you can execute to restart your Ubuntu server. Some of these commands can also work on the Ubuntu desktop version. For this post, we have Ubuntu Server 18.04 LTS running as a virtual machine on my Ubuntu desktop.

Ubuntu Server as Virtual Machine on Vmware
Ubuntu Server as Virtual Machine on Vmware

Reboot Command

It is so far the most straightforward method one can use to restart the Ubuntu server. Not only does it work for the Ubuntu Server, but also Ubuntu desktop and other Debian based Linux distributions.

$ reboot

In case you run the above command, and you get an error like “permission denied,” then you don’t have elevated privileges. You will have to add the sudo command. It’s illustrated below.

$ sudo reboot

This action will prompt you to enter your administrator password. Type your password and hit enter.

There is one more parameter you can add to this reboot command – the now command.

$ sudo reboot now

In case there are background running services, but you want to reboot the server, use the -f parameter, which means forcefully restart the server.

$ sudo reboot -f

Shutdown command

The shutdown command by itself is used to power-off your Ubuntu server. However, with an additional -r parameter, you can use it to restart your server or even the Ubuntu desktop. You might need to have elevated privileges, therefore, use the sudo command.

$ sudo shutdown -r

This command comes with a few more parameters that might be useful for your overall experience with the Ubuntu server. One of them is that you can set the server to reboot after a specific duration in minutes.

$ sudo shutdown -r +10

The above command will reboot your server after 10 minutes.

Any other logged-in users will see a message similar to the one below on their Terminal.

[fosslinux-server@dhcppc1 ~]# 
Broadcast message from root@dhcppc1
        (/dev/tty1) at 18:00 ...

The system is going down for reboot in 10 minutes!
Server will restart in 10 minutes. Please save your work.

You can also set a particular time that you want the server to reboot. You will need to specify the time the format of HH: MM.

$ sudo shutdown -r HH:MM
e.g
$ sudo shutdown -r 18:00

The above command will reboot my server at exactly 6:00 pm.

In case you want to cancel a set reboot schedule, execute the shutdown command, but remember to add the -c parameter.

$ shutdown -c

One more parameter we can use with the shutdown command is now. This means to reboot the server immediately.

$ sudo shutdown -r now

init command

The init command is used to perform several actions depending on the parameter given. The parameters are numbers 0 to 6 referred to as run levels. Run level 0 brings down/halt the system while run level 6 restarts the system.

sudo init 6

Conclusion

Those are three ways that you can use to reboot your Ubuntu server using commands. They can also be executed remotely via SSH using applications like Putty. If you are running a desktop version of any Debian-based distribution, these commands can also come in handy.

Is there is a command that you use and not listed above? Feel free to let our readers know in the comment section below. If you find this article useful, don’t forget to share the link with friends.

Arun Kumar
Arun did his bachelor in computer engineering and loves enjoying his spare time writing for FOSS Linux. He uses Fedora as the daily driver and loves tinkering with interesting distros on VirtualBox. He works during the day and reads anything tech at night. Apart from blogging, he loves swimming and playing tennis.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

STAY CONNECTED

23,536FansLike
365FollowersFollow
16SubscribersSubscribe

LATEST ARTICLES

How to install CouchPotato on Ubuntu

Downloading movies and copying them over to your home server can get frustrating, especially if you are doing it daily! What if you have an option to download videos automatically, quickly, and above all with excellent quality. CouchPotato allows you to download movies easily once they are available and released automatically.

Top 20 Rsync Examples in Linux

The Rsync (remote sync) command is a Linux/Unix utility used to synchronize and copy files and directories either locally or remotely. Most Linux geeks use Rsync to mirror, backup or migrate data across folders, across disks and networks. One notable feature with the Rsync command is that it uses the "delta transfer algorithm."

Setting up NFS Server on Ubuntu Server

We have put together a detailed step-by-step tutorial that will guide you on how to install and set up NFS Server on Ubuntu so you too can start sharing data with other client systems. It is divided into sections, the first part discussing how to set up the host server and the second part showing you how to set up the client-side. For this tutorial, we will be using Ubuntu 20.04 LTS.

Crontab in Linux Explained With Examples

Crontab is the Linux equivalent of the Window's Task Scheduler. It can help you set up a task to run automatically at a regular...

The 10 Best Linux Server Distros For Home And Businesses

By the year 2020, it is estimated that there are close to 600 Linux distributions in the market. It includes both servers and Desktop versions; therefore, if you are looking for lightweight Linux distribution for your old PC or a reliable desktop version for employees in your organization, you may be overwhelmed with the number of choices for finding one for your use.

How to list the installed Packages on Ubuntu

It is only natural to start installing more and more software on your Ubuntu PC once you start using it. Similarly, it is also natural to lose track of the different packages that you have installed on your system. Eventually, you may be overwhelmed with the number of packages in your system and with the ones you hardly used.

MUST READ

Linux is growing faster than ever. As per the latest report, there is a drop in the Windows 10 market share for the first time, and Linux's market share has improved to 2.87% this month. Most of the features in the list were rolled out in the Pop OS 20.04. Let's a detailed look into the new features, how to upgrade, and a ride through video.
Elementary OS 5.1 Hera has received a point release with a handful of new features and bug fixes, and we will be reviewing the significant changes in this article. For those new to elementary OS, this Ubuntu-based Linux distribution uses their inhouse built Pantheon desktop environment and AppCenter.

CopyQ – Advanced clipboard manager for Linux

We have all had that moment when we copied a text, but we first needed another one, and in the process, lost the first one. If you're lucky, you can get it back quickly with a bit of work.

Scrcpy – Control Android devices from a Linux desktop

Scrcpy is a desktop program that can be used to access your Android phone's system and interface through your computer. The app is quite convenient, and some of its best features are highlighted below.

10 Best PDF Editors for Linux

In this article, we will take a look at 10 of the best PDF editors and tools out there in 2019 that are available for Linux platforms. The editors are going to be judged on the basis of their functionalities, portability, ease of installation, price, and convenience.

10 Best Video Editing Software for Linux

This article is for all the Linux users out there who are looking for video editors to create their own professional videos, which can range from short documentaries to even movies.