![]() |
VOOZH | about |
Restoring or rebooting a working computer simply means restarting the computer. It often comes after one has installed some packages, upgraded an OS, recovered from errors, or even restored drivers or hardware devices. Through this post, more than one way of restarting Ubuntu in the terminal will be discussed, together with explanations and examples for each command.
The 'reboot' command is one of the easiest ways to reboot your Ubuntu system. It is part of the systemd tool suite, which is simple and efficient.
sudo reboot [options]sudo rebootThis command would immediately reboot your system after all processes running are stopped.
Option | Description |
|---|---|
now | Reboot right now without any delay |
-f, --force | Force an immediate reboot without gracefully stopping processes |
sudo reboot nowThis command will causes an immediate reboot with no warning.
The 'shutdown' command is a utility used to shut down, power-off, or reboot the computer. It provides more options for scheduling as well as sending a message to the users than 'reboot' does.
sudo shutdown [options] [time] [message]sudo shutdown -r nowThis will immediately reboot the computer
Option | Description |
|---|---|
-r | Restart the computer instead of shutting down |
-h | Shut down the computer. Similar to the power off command on most systems |
-c | Cancel an impending shutdown |
sudo shutdown -r +20This command will schedule the restart for after 20 minutes and sends a warning message to all logged-in users.
sudo shutdown -r 20:20This command will schedule a restart at 8:20 PM to provide fine-grained system restart timing.
The 'init' command is one of the legacy methods to change the system runlevel. Although it is still supported on most of the systems, it's deprecated in favor of systemd commands on Ubuntu's more recent releases.
sudo init [runlevel]sudo init 6This command tells the system to switch the runlevel to 6, which would normally cause the system to restart .
Runlevel | Description |
|---|---|
6 | Reboot the system |
2 | Reboot into multi-user mode (usual default in most systems of the current generation) |
s | Single-user mode (useful for system maintenance) |
sudo init 2This command puts the system into multi-user mode, as most of the Linux distributions have configured as the default runlevel.
The 'systemctl' command is part of the systemd suite, serving as the init system as well as service manager on modern Ubuntu versions. The 'systemctl' command gives an easy uniform interface toward controlling the state of the system.
sudo systemctl [command]sudo systemctl rebootThis command will reboot the system by the systemd service manager.
Command | Description |
|---|---|
reboot | Shutdown and reboot a Linux system in a clean and orderly fashion |
poweroff | Power off the system, which is similar to shutdown -h now |
halt | Halt the system that means stopping all the CPU functions but power remains on |
There are multiple methods to reboot the system from the terminal in Ubuntu. Many have their specific niche usages and advantages. To restart one can use either the 'reboot' command or 'systemctl reboot', both of which are very direct, unambiguously efficient methods. The command 'shutdown' gives much more flexibility in regards to scheduling and user notification. Of course the 'init' command still works, but on recent versions of Ubuntu, it's usually better to switch to more modern systemd commands. Knowing these commands will make it easier for you to administer Ubuntu systems to get what you want done.