Chapter 15. Shutting down, suspending, and hibernating the system

This section contains instructions about shutting down, suspending, or hibernating your operating system.

15.1. System shutdown

To shut down the system, you can either use the systemctl utility directly, or call this utility through the shutdown command.

The advantage of using the shutdown command is:

  • The support for time argument

    This is particularly useful for scheduled maintenance. Also, users have more time to react to the warning that a system shutdown has been scheduled.

  • The option to cancel the shutdown

15.2. Shutting down the system using the shutdown command

By following this procedure, you can use the shutdown command to perform various operations. You can either shut down the system and power off the machine at a certain time, or shut down and halt the system without powering off the machine, or cancel a pending shutdown.

Prerequisites

  • Switch to the root user

Procedure

  • To shut down the system and power off the machine at a certain time, use the command in the following format:

    shutdown --poweroff hh:mm

    Where hh:mm is the time in 24 hour clock format. The /run/nologin file is created 5 minutes before system shutdown to prevent new logins.

    When a time argument is used, an optional wall message can be appended to the command.

    Alternatively, to shut down and halt the system after a delay, without powering off the machine, use:

    shutdown --halt +m

    Where +m is the delay time in minutes. The now keyword is an alias for +0.

    To cancel a pending shutdown, use:

    shutdown -c

Additional resources

15.3. Shutting down the system using the systemctl command

By following this procedure, you can use the systemctl command to perform various operations. You can either shut down the system and power off the machine, or shut down and halt the system without powering off the machine.

Prerequisites

  • Switch to the root user

Procedure

  • To shut down the system and power off the machine, use the command in the following format:

    systemctl poweroff

    Alternatively, to shut down and halt the system without powering off the machine, use:

    systemctl halt
Note

By default, running either of these commands causes systemd to send an informative message to all users that are currently logged into the system. To prevent systemd from sending this message, run the selected command with the --no-wall command line option.

15.4. Restarting the system

You can restart the system by following this procedure.

Prerequisites

  • Switch to the root user

Procedure

  • To restart the system, run the following command:

    systemctl reboot
Note

By default, this command causes systemd to send an informative message to all users that are currently logged into the system. To prevent systemd from sending this message, run this command with the --no-wall command line option.

15.5. Suspending the system

You can suspend the system by following this procedure.

Prerequisites

  • Switch to the root user.

Procedure

  • To suspend the system, run the following command:

    systemctl suspend

    This command saves the system state in RAM and with the exception of the RAM module, powers off most of the devices in the machine. When you turn the machine back on, the system then restores its state from RAM without having to boot again.

    Because the system state is saved in RAM and not on the hard disk, restoring the system from suspend mode is significantly faster than from hibernation. However, note that the suspended system state is also vulnerable to power outages.

Additional resources

15.6. Hibernating the system

By following this procedure, you can either hibernate the system, or hibernate and suspend the system.

Prerequisites

  • Switch to the root user.

Procedure

  • To hibernate the system, run the following command:

    systemctl hibernate

    This command saves the system state on the hard disk drive and powers off the machine. When you turn the machine back on, the system then restores its state from the saved data without having to boot again.

    Because the system state is saved on the hard disk and not in RAM, the machine does not have to maintain electrical power to the RAM module. However, as a consequence, restoring the system from hibernation is significantly slower than restoring it from suspend mode.

    Alternatively, to hibernate and suspend the system, run the following command:

    systemctl hybrid-sleep

Additional resources

15.7. Overview of the power management commands with systemctl

You can use the following list of the systemctl commands to control the power management of your system.

Table 15.1. Overview of the systemctl power management commands

systemctl commandDescription

systemctl halt

Halts the system.

systemctl poweroff

Powers off the system.

systemctl reboot

Restarts the system.

systemctl suspend

Suspends the system.

systemctl hibernate

Hibernates the system.

systemctl hybrid-sleep

Hibernates and suspends the system.