OSETC TECH

CentOS 7 /RHEL7: Shut down/Restart/Suspend/Hibernate The System

I would like to shut down or restart the system in the centos 7 or rhel 7, How to shutdown system? which commands I can use to shutdown the system? of course, you still can use the “poweroff” command to shutdown the system, this is an old command in the centos 6.x or previous version. In centos 7 or Rhel 7, A number of power management commands used in old centos version or rhel are replaced by systemctl utility.

You are able to use systemctl command with “poweroff” option to shutdown the system or with “reboot” option to restart the system. those old commands are still available to use for compatibility only in centos 7 or rhel 7.

In this post you will see that how to use systemctl utility shut down/restart/suspend/hibernate the system.

CentOS 7 /RHEL7 Shut down/Restart/Suspend/Hibernate The System

CentOS 7 shut down the system

To shutdown and power-off the centos 7 or rhel 7 system, issue the following command, type:

systemctl poweroff

This command not only shutdown the system, but also prints a wall message to all users that are currently logged into the system. If passing with “–force” option, shutdown of all running services is skipped, however all processes are killed and all file systems are unmounted or mounted read-only. type:

systemctl poweroff --force

CentOS 7 restart the system

To shutdown and reboot the system, using the following systemctl command with reboot option, type:

systemctl reboot

This command also will send a wall message to all logged user in the current system. if passing “–force” option to this command, the operation action is similar with “poweroff”. enter:

systemctl reboot --force

Note: if “–force” option is specified twice, the operation is immediately executed without terminating any processes or unmounting any file systems, this my result in data loss.

systemctl reboot --force --force

CentOS 7 suspend the system

To suspend the system, issue the following systemctl command with “suspend” option, type:

systemctl suspend

This command will save the system state in RAM and put the machine in a sleep state, and the system still requires power in this state.As the system state is saved in RAM, so its restoring speed of the system is fast.

CentOS 7 hibernate the system

To hibernate the system, issue the following command as root user:

systemctl hibernate

this command will fully powered off the system and the system state is saved to disk. the system does not require power, and can stay in hibernate mode indefinitely. because the system state is not saved in RAM, so its restoring speed of the system is slower than suspend mode.

Done…..