How To Reboot A Linux Server using the command line [Beginner's Tutorial]
# tutorial# how to

How To Reboot A Linux Server using the command line [Beginner's Tutorial]

Are you trying to reboot or shutdown your Linux or CentOS server using the command line? Whether you’re making modifications to config files or are restarting the server to do some debugging, restarting a Linux from the command line should be a breeze.

There are many reasons why you might want to reboot your server, so in this blog post, I’m going to tell you how to do just that.

Ready? Let’s dive right into this tutorial…

Linux/CentOS Shutdown / Reboot Command

On Linux, the shutdown and reboot commands can be executed via the command line, there’s several commands that you can run, they include:

  • reboot
  • shutdown
  • half
  • poweroff

I’ll teach you how to use these commands to restart your server. Up until this point, you might be familiar with just turning the machine off and on again, this is okay if you have a screen/monitor.

But more often than not, you’re remotely connected to the server without a screen or fancy interface.

Sometimes you need to restart a server if you’re doing upgrades or carrying out maintenance work.

Linux "reboot" command

The easiest and safest way to reboot a Linux server is to use the reboot command. To reboot the server gracefully and do it right now, run:


This command would attempt to stop and running services, and then attempt to reboot the server.

If running that command doesn’t work, you can forcefully reboot a Linux server using:

reboot -f

Although it’s recommended to reboot gracefully first.

Linux "shutdown" command

The first of the commands is the shutdown command. It can be used to shut down the server, but can also be used to restart it.

In order to shutdown Linux, you’ll want to run:

shutdown -h now

The -h flag is used to halt the server and the now param is used to shutdown the system right away.

If you wanted to reboot the server using the shutdown command, you’d run:

shutdown -r now

If you needed to schedule a reboot within the next 5 minutes, you would run:

shutdown -r +5

And what this is doing, is essentially saying to reboot the server within the next 5 minutes. Which would notify all users logged in the server, and also prevent new users from logging in.

You could specify any duration in minutes here.

Once you run this command and wanted to cancel the scheduled restart or shutdown, simply run:

shutdown -c

Linux "halt" command

Another option at your disposal is to use the halt command. Unlike reboot and shutdown, this command will halt the server. Although, the behaviour of this command may not be consistent across several servers.



Linux "poweroff" command

Have you ever held the power button on your computer before to turn it off, well, the poweroff command is similar to the halt command, but is simply an alternative.


Why might you want to reboot a Linux server?

If you’re making changes to a server such as upgrading it or carrying out maintenance works, then you’ll likely need to reboot the server at some point.

Sometimes though, computers and servers can experience all kinds of glitches from simply being left on for long periods of time, and so a reboot could be a way of clearing out temporary files and is useful for debugging situations!


As a beginner, the shutdown and reboot commands are meant to be as simple and as effective as possible, so there shouldn’t be any troubles when trying to run these commands.

Of course though, just ensure that any changes have been saved before you restart the server. Or you’ll lose them!

More posts

Introducing Notification Contacts

Notification Contacts make alerting team members incredibly easy and simple, find out more about this new feature that we've released for all of our customers!

Read more
Pretty Purchases Joins Our Website Monitoring Tool

Here at the Domain Monitor, we're delighted to announce that Pretty Purchases, a UK based E-Commerce website that specialises in selling handbags has joined our website monitoring tool, learn more and find out how you can get a 5% discount today!

Read more
The 5 Things You Need To Do When Your Website Goes Down

If you've ever received a notification from our website uptime monitoring tool, you'll know how scary it can be to find out your website is down, your stomach literally drops and you start to panic, is your website actually down? Here's what to do when your website goes down.

Read more

Get our FREE downloadable PDF revealing The Top 3 Benefits Of A Website Monitoring Tool!

Plus, more great content, product news and updates