reboot Command
Purpose
Requests the system to restart.
Syntax
reboot [ -d ] [ -f ] [ --halt ] [ -h ] [ -n ] [ --poweroff ] [ --reboot ][ -w ]
Description
The reboot command request the system to restart. The
reboot command contacts the init system
(systemd) to perform an orderly shutdown, restart, or power off. It also performs
other operations such as notifying the services, unmounting file systems.
When the system enters run level 0 (halt) or 6 (reboot), or
when the reboot command is used with the --force option, the
init system is bypassed. In these cases, the reboot system call
is invoked directly, without performing the shutdown sequence. This approach results in a faster
shutdown or restart. However, it is considered unsafe, as file systems might not be properly synced
or unmounted, increasing the risk of data loss or corruption.
Flags
| Items | Description |
|---|---|
| -d or --no-wtmp | Restarts the system without writing a who temporary (wtmp) record. |
| -f or --force | Forces immediate restart, halt, or power off. This option does not contact the
init system and directly calls the reboot system call. This
option might result in data loss if the file systems are not synced. The -f
flag is useful in emergency situations or when the system is already in run level 0 or 6. |
| --halt | Halts the system, regardless of the command used. |
| -h or --help | Displays help about the reboot command. |
| -n or --no-sync | Instructs the system to halt, restart, or power off without syncing the file systems. This option must be used only for debugging. |
| --poweroff | Powers off the system, regardless of the command used. |
| --reboot | Restarts the system, regardless of the command used. |
| -w or --wtmp-only | Writes the wtmp shutdown entry without restarting, halting, or powering off
the system. |
Exit status
This command returns the following exit values:
| Item | Description |
|---|---|
| 0 | Successful completion. |
| Nonzero | A nonzero failure code is returned when the reboot command fails. |