The reboot
command in Linux is used to restart the system from the command line. It shuts down all running processes, unmounts file systems, and then reboots the machine. This command helps with system maintenance, updates, or recovery from critical issues.
The following text will explain the Linux reboot
command using practical examples.

Prerequisites
Note: The reboot
command acts as a shortcut for more advanced system commands, like systemctl
which is used on many Linux systems with systemd as the init system. While it provides basic functionality for restarting the system, it lacks the full range of features available in systemctl
. For more complex reboot scenarios, such as restarting into firmware settings or a specific boot target, it's better to use systemctl reboot
directly.
Linux reboot Command Syntax
The basic reboot
command syntax is:
reboot [OPTIONS]
The command works without any options. Running reboot
on its own triggers a standard system reboot by signaling the init system (such as systemd
) to shut down processes and restart the system.
Options are not mandatory, but allow users to modify how the reboot is performed.
Linux reboot Command Options
The reboot
command in Linux offers various options that modify its behavior, which gives system administrators control over how the system restarts.
The following table presents common reboot
options:
Option | Description |
---|---|
-d , --no-wtmp | Does not write a shutdown record to the wtmp log. Used in advanced scenarios where system logging is intentionally suppressed. |
-f , --force | Forces an immediate reboot without contacting the init system. |
-i | Shuts down all network interfaces before rebooting. |
-n , --no-sync | Does not sync hard disks before rebooting. |
-p , --poweroff | Powers off the system after halting. |
-w , --wtmp-only | Writes a wtmp reboot record without actually rebooting the system. |
--boot-loader-entry=ID | Boots into a specific bootloader entry on the next boot. |
--halt | Halts the system without powering it off. |
--help | Displays help information about the reboot command. |
--no-wall | Suppresses the broadcast message to all users about the impending reboot. |
--reboot | Reboots the system and presents the default behavior. However, it has no practical effect, and it's unnecessary to explicitly use it when rebooting the system. |
Linux reboot Command Examples
The reboot
command in Linux is commonly used to restart the system, either to apply updates, recover from system hangs, or perform maintenance.
Below are practical examples of how to use the reboot
command with various options to handle different scenarios.
Note: Most reboot
command options provide no output.
How to Restart Remote Linux Server
To restart a remote Linux server, first connect to it using SSH. Then, issue a reboot
command from the terminal to restart the system.
SSH into the remote server using the following command:
ssh username@remote_server_ip
In this example, the command is:
ssh [email protected]
After logging in, run:
sudo reboot
The command prompts for your sudo password and then restarts the server without providing any output.
How to Immediately Restart Linux
To restart a Linux system immediately, use the reboot
command without any arguments. This command initiates a system restart, and it's used when there's a need for a quick reboot. However, the command still waits for processes to terminate gracefully, depending on the init system.
Run the following:
sudo reboot
Once executed, the system begins the restart process immediately.
How to Deal with System Hang During Restart
Occasionally, you need to force an immediate restart, especially if the system is unresponsive, hanging during reboot, or if you want to bypass the regular shutdown process.
Do this with the -f
or --force
option with the reboot
command:
sudo reboot -f
The -f
option forces an immediate reboot, ignoring any running processes or scheduled tasks that delay the restart. However, note that forcing a reboot often results in data loss or corruption if there are unsaved changes or running processes.
How to Prevent Wall Messages During Restart
By default, the reboot
command sends a wall message to all logged-in users, notifying them that the system is going down. The message looks similar to this:
To suppress this broadcast, use the --no-wall
option.
sudo reboot --no-wall
This command reboots the system without sending a warning message to other users via the terminal. It is especially useful on multi-user systems where silent maintenance is preferred.
The system begins rebooting right away.
How to Deal with Failure to Restart
In some cases, the reboot
command fails to restart the system. This occurs due to insufficient privileges, a stuck process, or issues with the system's init process.
If the reboot command doesn't work, try alternative methods to force the system to restart: the init 6
command and the shutdown command with the -r
option.
The init 6
command directly instructs the init system to reboot:
sudo init 6
The command triggers a reboot by instructing the init system to initiate the reboot sequence. This bypasses some issues that prevent the regular reboot command from working.
If the init 6 command doesn't resolve the issue, use the shutdown
command with the -r
option:
sudo shutdown -r now
The command performs an immediate system reboot. The -r
option specifies a restart, while now
indicates the system should reboot immediately.
Both methods are useful alternatives when facing system issues during a restart. However, it's important to be cautious when using these commands in critical environments, as forcing a reboot may lead to data loss or corruption.
How to Skip Writing Shutdown Logs
In certain advanced scenarios, you can decide not to record a reboot event in the wtmp file, which is a system log that records logins, logouts, shutdowns, and reboot events.
The --no-wtmp
option allows you to suppress this logging:
sudo reboot --no-wtmp
This command is useful when you intentionally avoid system logs, for example, in automated scripts or during testing.
How to Shut Down Network Interfaces Before Rebooting
If your reboot process requires shutting down all network interfaces beforehand, use the -i
option. This ensures no network services remain active before the system restarts.
Run the following:
sudo reboot -i
The command shuts down all active network interfaces before initiating the reboot process, which ensures network configurations are fully reset when the system reboots.
How to Skip Syncing Hard Disks
The --no-sync
option allows you to reboot the system without syncing hard disks. This is useful when syncing isn't required or where it slows down the reboot process.
Use this command:
sudo reboot --no-sync
Using --no-sync
skips the default disk synchronization, which speeds up the reboot but should be used cautiously as it risks data loss if there are unsaved changes.
How to Reboot and Power Off
To power off immediately after rebooting, use the -p
option. This is useful for automated shutdowns where you want the system to turn off after rebooting.
Execute the following:
sudo reboot -p
The option halts the system and powers it off automatically. This eliminates the need for a manual shutdown after the reboot process completes.
How to Log Reboot Without Rebooting
The --wtmp-only
option writes a reboot entry to the wtmp log without rebooting the system. This is useful for logging purposes without triggering a system restart.
sudo reboot --wtmp-only
With this command, only the wtmp log is updated to reflect a reboot, but no actual reboot happens. It's used to log an event without affecting the system.
To verify the log entry, use the last -x
command with grep:
last -x | grep reboot
The entries marked as still running
are not actual reboots. They indicate the system never went down and that they were created by --wtmp-only
. This confirms the command updated the log without rebooting the system.
How to Specify Bootloader Entry
A bootloader is a low-level program that loads and transfers control to the operating system kernel. On most Linux systems, Grand Unified Bootloader (GRUB) serves as the bootloader and manages multiple boot options, such as different kernels or diagnostic tools.
To boot into a specific bootloader entry on the next reboot, specify the entry ID using the --boot-loader-entry
option:
sudo reboot --boot-loader-entry=ID
This option selects a specific bootloader entry to be used during the next reboot, which is useful in multi-boot setups or when testing different kernel configurations.
To list available GRUB entries, inspect the GRUB configuration file:
sudo grep ^menuentry /boot/grub/grub.cfg
Entries are indexed starting from 0. In the example above, the entries are:
- 0. Ubuntu.
- 1. Memory test.
- 2. Memory test (serial console).
To reboot into the second GRUB menu entry (e.g., memory test), use:
sudo reboot --boot-loader-entry=1
This tells the system to boot into the selected entry once, without changing the default GRUB behavior. It's useful for temporarily switching environments, like testing alternate kernels or running diagnostics.
How to Halt the System
To halt the system immediately without powering it off, use the --halt
option. This doesn't reboot the system, but stops all system processes and leaves the system in a halted state, ready for manual intervention.
Run the following:
sudo reboot --halt
The command halts the system, meaning it stops all processes, unmounts filesystems, and leaves the machine in a non-operational state. Power remains on, but the system does not reboot or shut down.
This command does not return any output to the terminal. In most cases, the screen shows System halted
or freezes (like in the image below), and the machine must be manually rebooted or powered off.
How to Get Help with Reboot Command
If you're unsure about any options or need a quick reference to the available flags, the --help
option displays detailed information about the reboot
command.
sudo reboot --help
Using --help
shows a detailed list of all the available options for the reboot command, enabling you to understand how to use it effectively in different scenarios.
Conclusion
This tutorial explained what the reboot
command is, its syntax, and options. It also elaborated on its practical use with different examples.
Next, learn how to start, stop, and restart services in Linux.