Every Operating System provides the facility of restarting your system as a solution to various problems. Ubuntu provides both Command Line and Graphical User Interface to restart the system.
Here at Ibmi Media, we shall look into the Command-Line approach to restart the Ubuntu system.
Importance of Restarting Ubuntu system
Any faulty software is deleted from active memory when a machine is restarted. The system loads the new copies of the software into active memory when it restarts. In addition, some operating systems necessitate a restart to complete updates or configurations. The reboot procedure allows stalled programs to exit, critical fixes to be applied, temporary files to be removed, damaged file systems to be repaired, and many other system administration chores to be completed.
How to Restart Ubuntu from the Terminal ?
To restart Ubuntu from the terminal, the below-mentioned commands will be used:
- Restart Ubuntu by using the shutdown command.
- Restart Ubuntu by using the reboot command.
- Restart Ubuntu by using the init command.
- Restart Ubuntu by using the systemd way.
1. Restart Ubuntu by Using the Shutdown Command
This command is used to turn a system off, on, or restart it. It specifies the execution time with a time argument. For instant operation, the time parameter is set to "now". Run the below-mentioned command to reboot the system now using the shutdown command:
$ sudo shutdown -r now
Run the below-mentioned command to restart the system after 1 min using the shutdown command:
$ sudo shutdown -r 1
In a 24-hour time format, the format is "hh:mm". We may also use "+m" to force a reboot in "m" minutes.
Run the mentioned command to reboot the system at 12:45 pm:
$ sudo shutdown -r 12:45
Run the below-mentioned command to cancel the restart of the system by using the shutdown command:
$ shutdown -c
2. Restart Ubuntu by Using the Reboot Command
The reboot command is the quick and easy way to restart a machine from the terminal. Run the mentioned command below to restart your Ubuntu system:
3. Restart Ubuntu by Using the init Command
The "/sbin/init" is the very first running process when the kernel is loaded in Ubuntu. It denotes that the process has a PID of 1. In Linux systems without "systemd" the 'init' command kills all current processes and synchronizes the discs before altering init states or run levels. Run level 5 is the default state. The 'init 6' command brings the system to a pause and restarts it in the specified state in the '/etc/inittab' file.
Run the mentioned below command to restart the Ubuntu system using the init command:
$ init 6
Run the below-mentioned command to restart the Ubuntu system into a multiuser mode:
$ sudo init 2
4. Restart Ubuntu by Using systemd Way
The "init" process has been substituted with "systemd" therefore '/sbin/init' has become a symbolic link to systemd.
You might not be able to locate '/etc/inittab' on systems that use systemd instead of the init system. Run the command mentioned below to restart the system:
$ sudo systemctl reboot