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.
Method 1: Reboot 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.
Syntax
sudo reboot [options]Basic Example
sudo rebootThis command would immediately reboot your system after all processes running are stopped.

Key Options
Option | Description |
|---|---|
now | Reboot right now without any delay |
-f, --force | Force an immediate reboot without gracefully stopping processes |
Example with option:
sudo reboot nowThis command will causes an immediate reboot with no warning.

Method 2: Shutdown Command
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.
Syntax
sudo shutdown [options] [time] [message]Simple Example
sudo shutdown -r nowThis will immediately reboot the computer

Key Options
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 |
Example using time option:
sudo shutdown -r +20This command will schedule the restart for after 20 minutes and sends a warning message to all logged-in users.

Example using an exact time:
sudo shutdown -r 20:20This command will schedule a restart at 8:20 PM to provide fine-grained system restart timing.

Method 3: Init Command
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.
Syntax
sudo init [runlevel]Basic Example
sudo init 6This command tells the system to switch the runlevel to 6, which would normally cause the system to restart .

Key Options
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) |
Multi-user mode example:
sudo init 2This command puts the system into multi-user mode, as most of the Linux distributions have configured as the default runlevel.

Method 4: Systemd Command
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.
Syntax
sudo systemctl [command]Basic Example
sudo systemctl rebootThis command will reboot the system by the systemd service manager.

Key Options
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 |
Conclusion
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.