Home >System Tutorial >LINUX >What types of reboot commands are there in Linux?

What types of reboot commands are there in Linux?

下次还敢
下次还敢Original
2024-04-12 12:54:141378browse

Linux system provides a variety of restart commands: normal restart: reboot, sudo init 6 forced restart: sudo systemctl reboot --force specified run level restart: shutdown -r N, sudo init N planned restart: shutdown -r now, shutdown -r N system recovery: poweroff, sudo systemctl poweroff

What types of reboot commands are there in Linux?

Linux Restart command type

Linux system Has various types of restart commands for restarting the system when needed. These commands vary based on their behavior and goals.

1. Normal restart

  • reboot: Perform a normal system restart, close all processes and reload the operating system.
  • sudo init 6: Same as reboot, but uses the init command.

2. Force reboot

  • force reboot: Force reboot the system, which will not shut down the process and may cause data corruption lost.
  • sudo systemctl reboot --force: Use the systemd service manager to force a reboot.

3. Reboot to the specified run level

  • shutdown -r N: Reboot to the specified run level, where N is the target runlevel. For example, shutdown -r 0 will reboot to shutdown state.
  • sudo init N: Use the init command to restart to the specified run level.

4. Plan to restart

  • shutdown -r now: Restart the system immediately.
  • shutdown -r N: Restart the system after N minutes.

5. System recovery

  • poweroff: Turn off the system power and will not restart.
  • sudo systemctl poweroff: Use the systemd service manager to power off.

Usage Notes:

  • root permissions: Most restart commands require root permissions, so ## must be used #sudo command.
  • Data loss: Forced restart may cause data loss, so please be sure to back up important data before use.
  • Active processes: A normal restart will shut down all processes, while a forced restart will retain active processes, which may lead to unexpected consequences.
  • Run Levels: It is important to understand the different run levels and ensure that the target run level meets your requirements.

The above is the detailed content of What types of reboot commands are there in Linux?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn