How to use the Linux Shutdown command on Ubuntu 18.04 and CentOS 7

Most popular operating systems allow you to shut down your PC or laptop using different methods. Linux operating systems also have ways for a user to safely shutdown, reboot, hibernate, or suspend theirs. In this tutorial we will show you how to safely use the Linux Shutdown command to shutdown, reboot, or hibernate your .

We will help you do this by considering two different Linux versions: CentOS 7 and Ubuntu 18.04.

Shutting down or restarting the server is important on all operating systems, this will allow everything to work as expected. Shutting down the server via the line is a safe way to do this, as it notifies all registered users that the system is about to shut down.

Then we will even show you how to program the operating system to turn off at a certain time.

Shutdown command on Linux Ubuntu and CentOS

The shutdown command (Shutdown) in Ubuntu and CentOS allows you to shut down, restart and stop your system. The command syntax used to shut down and restart the machine is:

shut down

The Shutdown command can restart, stop, or shutdown.

The first argument can be a character string, followed by the time details . After the argument, you can optionally write a message in to notify registered users that the system will be shut down.

The format for the time string is hh:mm (hour/minute), as a 24-hour time. This will specify the time at which the shutdown command will be executed. Alternatively, you can use +m, where m indicates minutes. This way you can tell the machine to turn off for the number of minutes you want.

See also  IPv4 vs IPv6 - Comparison of Internet Protocols

you can also use now (now) in the syntax, which is an alias for +0 minutes, this will activate the immediate shutdown of your VPS. If you don’t specify the argument Linux by default applies +1 before closing.

Note that a time argument is required if you want to specify a message for all other users. The file /run/login will be created 5 minutes before system shutdown to ensure no more logins are allowed, this will happen if and only if you have specified a time string.

Using the Shutdown command on Linux Ubuntu and CentOS

The shutdown command for Ubuntu and CentOS is relatively similar. Each command shown below can be used in your Terminal. Remember that you will have to use SSH to access your VPS server. We have a that covers this process using putty!

The basic shutdown command for CentOS and Ubuntu looks like this:

shutdown

The above command will not shut down your PC immediately, it will set a one minute timer before shutting down. Remember to save your work before the shutdown occurs.

To shut down your PC immediately, type the following command and press enter:

shutdown now

As we mentioned before, the command is the same for both operating systems.

To shut down your PC at a specific time, type the following command and press enter:

shutdown hh:mm

The Linux shutdown command follows a 24-hour format, so type the time instead of H H and minutes instead of hmm.

To shut down after a few minutes or hours, type the following command and press enter:

See also  All in One SEO and OptinMonster plugins improved for security patch

shutdown +m

Remember, here m indicates minutes. It only specifies the number of minutes.

To display a message before shutting down the computer to people logged into your VPS, type the following command and press Enter:

Shutdown +m “Save your work, the PC will shut down in 5 minutes”

Here the text in quotes can be any message you want.

Restart your VPS using the Linux Shutdown command

To safely reboot your PC, use the following command:

shutdown –r

This command will not reboot your machine immediately, it will set a one minute timer before rebooting. So you can save your work before it restarts.

To restart your PC immediately, simply add the option nowas we discussed earlier.

shutdown –r now

To schedule a system reboot, type the following command and press enter:

shutdown –r hh:mm

To restart your computer after a few minutes or hours, type the following command and press enter:

shutdown –r +m

remember, here m indicates minutes. It only specifies the number of minutes.

To display a message to people logged into your server before it restarts, type the following command and press enter:

Shutdown -r +m “Save your work, PC will reboot in 5 minutes”

Here are some additional Linux Shutdown command options that you can become familiar with:

  • -poweroff, -P: Power off the system (turning off the drive as well)
  • -reboot, -r: reboot the system.
  • -halt, -h: Stops the machine after finishing the processes.

You can also shut down the system using the halt and poweroff options using the following command:

shutdown –h

See also  10 WordPress RSS Feed Plugins to Easily Share the Latest Content

To stop use:

shutdown –p

In the above commands, you can also specify the time and then the message to display after the option argument.

Cancel a scheduled shutdown command in Linux

To cancel a scheduled shutdown or restart of your PC, simply type the following command before reaching the scheduled time for the PC to shut down.

shutdown –c

This command will immediately cancel the scheduled shutdown or reboot action. Note that you cannot use this command if you used +0 on the command line or now.

To end

We hope this article has helped you learn how to use the Linux Shutdown command and its options to shut down your system. If you still have questions or confusion during the tutorial, please let us know so we can help you resolve it.

Deyi is a digital marketing enthusiast, with a background in web design, content creation, copywriting, and SEO. She is part of ‘s SEO & Localization team. In her free time, she likes to develop projects, read a book or watch a good movie.

Loading Facebook Comments ...
Loading Disqus Comments ...