When you are managing a Linux server remotely via SSH, or working on a headless machine (a computer without a monitor or graphical user interface attached), you cannot simply click a “Restart” button in a menu. Instead, you must rely entirely on the command line.
Rebooting a Linux system from the terminal is a fundamental administrative task. Whether you have just installed a new kernel update, modified critical system configuration files, or need to clear a severe system hang, knowing how to safely restart the machine is essential.
In this guide, we will explain the standard commands used to reboot a Linux system, how to schedule a reboot for a specific time, and how to force a restart when the system is unresponsive.
## The Standard Reboot Command
The most direct and commonly used method to restart a modern Linux distribution (such as Ubuntu, Debian, CentOS, or Fedora) is the `reboot` command.
Because restarting a system immediately disconnects all users and stops all running services, it is a privileged action. You must execute this command with root privileges, which means you will typically need to prepend it with `sudo`.
Open your terminal and type:
“`bash
sudo reboot
“`
You will be prompted to enter your user password. Once authenticated, the system will immediately begin sending termination signals to all running processes, unmount file systems safely, and restart the machine. If you are connected remotely via SSH, your connection will be instantly dropped.
## Using the Shutdown Command to Reboot
While the `reboot` command is convenient, the `shutdown` command offers much more flexibility. By passing specific flags to `shutdown`, you can restart the machine instead of simply turning it off.
To reboot the system immediately using `shutdown`, use the `-r` (restart) flag along with the time argument `now`:
“`bash
sudo shutdown -r now
“`
This performs the exact same sequence as the `sudo reboot` command, bringing the system down gracefully and restarting it immediately.
## How to Schedule a Reboot
The true power of using the `shutdown` command is the ability to schedule the restart. If you are managing a server used by multiple people, you usually want to give them advance warning before kicking them offline.
### Rebooting After a Delay
You can tell the system to reboot after a specific number of minutes. For example, to restart the server in 15 minutes, you would use:
“`bash
sudo shutdown -r +15
“`
The system will broadcast a warning message to all currently logged-in terminal users, letting them know the system will go down for a reboot in 15 minutes.
### Rebooting at a Specific Time
You can also schedule the reboot for a precise time using a 24-hour clock format (HH:MM). For example, to schedule a reboot for 2:30 AM during a maintenance window, type:
“`bash
sudo shutdown -r 02:30
“`
### Adding a Custom Warning Message
When scheduling a delayed reboot, you can append a custom message to the command so users know *why* the server is restarting.
“`bash
sudo shutdown -r +10 “System updating: Please save your work and log out.”
“`
### How to Cancel a Scheduled Reboot
If you schedule a reboot but realise you made a mistake (or a critical task is still running), you can cancel the pending shutdown.
To cancel, use the `-c` flag:
“`bash
sudo shutdown -c
“`
*(Note: You can optionally add a broadcast message here as well, e.g., `sudo shutdown -c “Maintenance postponed.”`)*
## What to Do If the System Is Unresponsive
In rare cases, the operating system may be so heavily bogged down or hung that a standard `sudo reboot` command hangs indefinitely.
If you absolutely must force the system to restart immediately—bypassing the graceful termination of processes and unmounting of disks—you can force the reboot.
**Warning:** Forcing a reboot is dangerous and can lead to data loss or filesystem corruption. It is the software equivalent of pulling the power cable out of the wall. Only use this as a last resort.
To force an immediate reboot, add the `-f` (force) flag to the reboot command:
“`bash
sudo reboot -f
“`
If the system is using systemd (which almost all modern distributions do), you can also forcefully reboot using systemctl:
“`bash
sudo systemctl –force –force reboot
“`
The double `–force` flags tell systemd to completely ignore the standard shutdown sequence and instantly restart the kernel.