Home > Package & System Management > reboot

Guide to the reboot Command: Restarting the System

`reboot` command is used to safely restart a Linux system. It is utilized when applying system updates, troubleshooting issues, or needing to reset the system state. This guide explains the basic usage of `reboot` and highlights the differences with the recommended `systemctl reboot` method in modern Linux systems.

Overview of reboot

`reboot` command sends a shutdown signal to the system upon execution, terminating all processes and restarting the system. Administrator privileges (`sudo`) are required, and it should be executed after saving and closing all applications to prevent data loss.

Main Functions of reboot

`reboot` command is primarily used for the following purposes:

Key Use Cases

  • Applying system updates: Restarts the system to fully apply changes after kernel or critical system library updates.
  • Troubleshooting: Used when the system is unstable or a specific service is not functioning properly, attempting to resolve the issue by reverting to the initial state.
  • Resource release: Restarts the system to resolve accumulated memory leaks or resource depletion issues after prolonged execution.

`reboot` vs `systemctl reboot`

In the past, the `reboot` command handled the system restart directly, but in modern systemd-based Linux systems, `systemctl` plays a central role in managing all services of the system. Therefore, `systemctl reboot` is the more recommended approach.

  • **`reboot`**: A legacy method that often internally calls `systemctl reboot` or a similar command. Some systems may directly use kernel commands.
  • **`systemctl reboot`**: Part of systemd, managing the shutdown and restart processes of the system more systematically and safely. Ensures all services are properly terminated and provides more control options.

Safety Precautions for Restart

Before restarting, ensure that all open files are saved and running applications are closed. Especially when working on a remote server, consider checking for network settings issues after the restart to ensure reconnection is possible.

Key reboot Command Options

`reboot` command itself has simple options, primarily used to specify when to restart.

1. Basic Restart Options

Generated command:

Try combining the commands.

Description:

`reboot` Executes the command.

Combine the above options to virtually execute commands with AI.

Related Commands: shutdown and poweroff

In addition to `reboot`, there are useful commands related to system shutdown. Each has different purposes and should be used according to the situation.

System Shutdown (shutdown)

sudo shutdown -h now

You can schedule a time to safely shut down the system or shut it down immediately. `+m` means 'in m minutes', `hh:mm` indicates a specific time. `now` means shut down immediately. (e.g. `sudo shutdown -h now`)

Power Off the System (poweroff)

sudo poweroff

Shuts down the system and completely cuts off power. Equivalent to `systemctl poweroff`.

System Restart (shutdown -r)

sudo shutdown -r now

You can restart the system using the `shutdown` command. This is useful for notifying users about the restart.

Usage Examples

Learn how to safely and efficiently restart the system through various usage examples of the `reboot` command.

Immediate System Restart (Recommended Method)

sudo systemctl reboot

This is the safest and most commonly used command for immediate system restart.

Immediate Restart with Legacy `reboot` Command

sudo reboot

Functions the same as `systemctl reboot` on most modern systems, but using `systemctl` is clearer.

Restart System in 5 Minutes and Notify Message

sudo shutdown -r +5 "System will reboot in 5 minutes for maintenance."

Notifies all currently logged-in users that the system will restart in 5 minutes for maintenance and performs the restart.

Complete Power Off of the System

sudo systemctl poweroff

Shuts down the system and completely cuts off power supply. Used to completely turn off servers.

Cancel Restart (if Scheduled)

sudo shutdown -c

Cancels the scheduled restart/shutdown tasks made with the `shutdown` command.


Same category commands