SystemD - Shutting Down, Suspending, and Hibernating the Linux System (part 3)

SystemD - Shutting Down, Suspending, and Hibernating the Linux System (part 3)

3. SystemD - Shutting Down, Suspending, and Hibernating the Linux System

The systemctl utility from systemd replaces a number of power management commands used in previous versions of many linux distros like reboot, poweroff, halt and many more. We learn Power Management Commands with systemctl command that replace old power management commands.

Table 3.1 - Comparison of Power Management Commands with systemctl

Old Command New Command Description
halt systemctl halt Halts the system.
poweroff systemctl poweroff Powers off the system.
reboot systemctl reboot Restarts the system.
pm-suspend systemctl suspend Suspends the system.
pm-hibernate systemctl hibernate Hibernates the system.
pm-suspend-hybrid systemctl hybrid-sleep Hibernates and suspends the system.

3.1 Shutting Down the System

Using systemctl Commands

To shut down the system and power off the machine, type the following at a shell prompt as root:

~] systemctl poweroff

To shut down and halt the system without powering off the machine, run the following command as root:

~] systemctl halt

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, for example:

~] systemctl --no-wall poweroff

Using the old shutdown Command

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

~] 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 message, the wall message, can be appended to the command.

To shut down and halt the system after a delay, without powering off the machine, use a command in the following format as root:

~] shutdown --halt +m

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

3.2 Restarting the Linux System

To restart the system, run the following command as root:

~] systemctl reboot

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:

~] systemctl --no-wall reboot

3.3 Suspending the System

To suspend the system, type the following at a shell prompt as root:

~] systemctl suspend

3.4 Hibernating the System

To hibernate the system, type the following at a shell prompt as root:

~] systemctl hibernate

Another parts of this guide:

SUBSCRIBE FOR NEW ARTICLES

@
comments powered by Disqus