
The reboot
command in Linux restarts the system. It helps apply updates, clear temporary issues, or reinitialize services.
This article covers the reboot
command in detail and explains how to use it to restart a Linux system.
reboot
Command Syntax
The following is the syntax of the reboot
command:
reboot [OPTIONS]
Where the OPTIONS
affect how the system reboots.
root
user or have sudo privileges to execute the reboot
command.
reboot
Command Usage
The reboot
command without any options immediately restarts the system.
$ sudo reboot
This command ends all processes, which may cause the unsaved changes to be lost. Once you run this command, your terminal session ends, and the system restarts.
Working of reboot
Command
The reboot command invokes the systemd
to connect to the init system to shut down the system, and then starts it. It performs all the activities the shutdown
command performs before closing the system. You can change this behavior using the -f
option discussed in the next section.
reboot
Command Options
You can use the following options with the reboot
command:
--force
or-f
: Forces the system to restart without executing the shutdown activities, like unmounting drives, or notifying logged-in users about the reboot.--no-wall
: Skips printing the broadcast wall message. No logged-in user is notified about the reboot before their terminal sessions end.--no-sync
or-n
: Skips flushing the pending buffer data to disks. This is generally used in emergencies.--no-wtmp
or-d
: Skips the reboot entry that thereboot
command otherwise writes in the/var/log/wtmp
file.--wtmp-only
or-w
: Does not actually perform a system reboot; it just creates an entry for it in the/var/log/wtmp
file.
reboot
Command Alternatives
You can use the following commands to reboot a Linux system:
Command | Description |
---|---|
sudo systemctl reboot |
Uses systemd to trigger a system reboot. |
sudo shutdown -r now |
Shuts down and reboots the system. |
Conclusion
In this article, you have learned about the reboot
command, how to use it, how it works, and the different command options. Use the man reboot
command to view the reboot
manual page for more information.
No comments yet.