CommandsLinux

Shutdown and Reboot Linux From Command Line

Shutdown and Reboot Linux From Command Line

In this tutorial, we will show you how to shutdown and reboot Linux from command line. Are you tired of always reaching for the power button every time you need to shutdown or reboot your Linux computer? Did you know that you can use commands to perform these actions from the command line? In this blog post, we will discuss the Shutdown and Reboot Commands in Linux, and how to use them to power off and restart your Linux machine from the terminal. We’ll cover the basic usage of these commands, how to specify time intervals before the action is performed, and how to cancel a scheduled shutdown or reboot. Whether you are a Linux beginner or an experienced user, understanding how to use the Shutdown and Reboot commands is a valuable skill that can make your workflow more efficient and save you time. So, let’s dive in and learn how to master the power of the command line to manage your system’s power state!

Prerequisites

  • A server running one of the following operating systems: Debian-based or RHEL-based.
  • Access to a terminal: The terminal is a command-line interface that allows you to interact with your operating system. To open the terminal on Ubuntu, press Ctrl + Alt + T.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Differences between Shutdown and Reboot

Before we dive into the methods of shutting down and rebooting a Linux system, it’s important to understand the differences between the two. In simple terms, shutting down means powering off the system, while rebooting means restarting the system.

A shutdown is usually performed when the system is no longer needed, or when it’s time to perform maintenance work. On the other hand, a reboot is performed when the system is experiencing issues or to apply updates.

Shutdown Linux from the Command Line

Shutting down a Linux system from the command line is a straightforward task. The most commonly used command to shut down a system is shutdown. This command can be used with various options and flags to control the timing and behavior of the shutdown process.

Here’s the basic syntax for the shutdown command:

shutdown [options] [time] [message]

The options flag can be used to specify how the shutdown process should be carried out. The most common options are:

  • -h or --halt: This option is used to halt the system.
  • -r or --reboot: This option is used to reboot the system.
  • -P or --poweroff: This option is used to power off the system.

The time a parameter is used to specify the time for the shutdown process to be initiated. This time can be specified in minutes or in a formatted time string.

The message a parameter is an optional message that will be displayed to all logged-in users.

Here are some examples of how to use the shutdown command:

  • To shut down the system immediately:
sudo shutdown -h now
  • To shut down the system in 16 minutes:
sudo shutdown -h +16
  • To shut down the system at a specific time:
sudo shutdown -h 16:46

Reboot Linux from the Command Line

Rebooting a Linux system from the command line is similar to shutting down the system, with a few differences. The most commonly used command to reboot a system is reboot. This command can be used with various options and flags to control the behavior of the reboot process.

Here’s the basic syntax for the reboot command:

reboot [options]

The options a flag can be used to specify the behavior of the reboot process. However, it’s not as commonly used as with the shutdown command.

Here’s an example of how to use the reboot command:

sudo reboot

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button