How To Reboot Or Shutdown A Linux Server

In this guide I will be showing you how to reboot as-well as how to shutdown a Linux server using the command line. There are actually a couple of different ways you can do this, you can do this by logging into the server over SSH as-well as using remote IPMI commands to power cycle the server.

How To Reboot A Linux Server

Lets get started with rebooting a Linux server. Any of the following Linux reboot commands should do the trick for you.

sudo reboot
sudo init 6
sudo shutdown -r now
sudo shutdown -r +10 "Server will restart in 10 minutes. Please finish up what you are doing."

If you absolutely cannot wait and need the server to close processes and reboot properly, you can remotely power cycle the server using IPMI if your server supports it. You can also login over SSH and run the ipmitool commands locally. Either of the 2 following commands should do the trick.

sudo ipmitool chassis power reset
sudo ipmitool chassis power cycle

If ipmitool is not supported by your server, then you can still force a reboot using the following command.

sudo reboot -f

How To Shutdown A Linux Server

Next lets tackle shutting down a Linux server. You can do this with the init command, or a number of other methods including the shutdown command. One of the great things about the shutdown command is that it can also schedule a shutdown (for example 15 minutes to allow people to finish what they are doing). Here are a couple examples for shutting the server down gracefully.

sudo shutdown -h now
sudo init 0
reboot -p
halt
poweroff

Like I mentioned above, you can also schedule the shutdown to happen later on. Here is an example of scheduling a shutdown in 15 minutes with a warning to all logged in users.

sudo shutdown -h +15 "Server will shutdown in 15 minutes. Please finish whatever you are doing."

How To Cancel Shutdown Or Reboot

If you used the shutdown command to issue a delayed shutdown, you can abort it by using the following command.

sudo shutdown -c

I hope this post has helped you, please don’t forget to like, comment, or share. Thanks for the support!

Leave a Reply

Your email address will not be published. Required fields are marked *