Linux is a command line-based operating system where all tasks can be completed via the command line interface. We can restart the Linux system via command line interface using different commands and methods. In this tutorial, we examine how to restart Linux via command line interface.
Restart Linux with reboot Command
reboot command is one of the most popular command to restart Linux via command line inteface. We should also provide the
sudo command if we do not have the root privileges currently.
$ sudo reboot
Restart Linux with systemctl Command
systemctl command is created to manage Linux services. It can be also used to change the current runlevel of the Linux system and also restart the Linux. The
systemctl reboot can be used o restart Linux system. As expected the systemctl also requires root privileges which can be also provided with the sudo command.
$ sudo systemctl reboot
Restart Linux with shutdown Command
shutdown command is used to shutdown or poweroff a Linux system. But we can also use the shutdown command in order to restart a Linux system. We should provide the
-r option to reboot and also to reboot instantly the
now parameter should be provided.
$ sudo shutdown -r now
Restart Linux After Specified Time
We can restart Linux system after specified time. We can use the shutdown command to restart Linux after specified time. We restart Linux system after 2 minutes in the following example.
$ sudo shutdown -r +2
Restart the Remote Computer via SSH
We can also restart a remote Linux system by using the
ssh command. We simply use the ssh command in order to execute remote system restart commands like reboot, shutdown, systemctl etc.
$ ssh firstname.lastname@example.org "sudo reboot"