How do I reboot a Linux system using the command line?

Shutting down or rebooting a Linux system from the terminal is one of the most basic activities of every system administrator, done for applying necessary changes, resolving issues, or routine maintenance. This article explains the main commands and procedures for rebooting a Linux system.


Basic Reboot Command


The easiest Linux booting method is the reboot command. This command will reboot the Linux system. This command can be run under the root account since undertaking this command implies modifying the current system environment.


sudo reboot


This command immediately initiates a system reboot. The sudo prefix is crucial as it grants the necessary permissions to act.


Using the Shutdown Command


Another common method to reboot a Linux system is through the shutdown command. This command allows for more controlled shutdowns and reboots. To reboot the system immediately, you can use:


sudo shutdown -r now


Here, the -r option tells the system to reboot, while now indicates that the action should be taken immediately. The shutdown command can also be scheduled later by replacing now with a specific time (e.g., +5 for five minutes later) or a specific time format (e. g. , hh: MM is also referred to (mm).


Systemd and systemctl


On modern distributions based on the Linux operating system that utilizes systems as their init system, systemctl is an effective means of controlling system states; it also pertains to rebooting. Usually, to reboot the system using systemctl, the command is:


sudo systemctl reboot


This command effectively halts all processes and sends a reset signal to the motherboard, similar to the reboot command but integrated into the system framework.


Alternative Methods


In addition to the commands above, there are alternative methods to reboot a Linux system:


1. Init Command: For systems using SysVinit, the command to reboot is:


sudo init 6


This command corresponds to runlevel 6, designated for rebooting the system.


2. Using /proc Filesystem: A more advanced method involves writing directly to the /proc filesystem. To enable the SysRq system, you can execute:


echo 1 | sudo tee /proc/sys/kernel/sysrq


Then, to reboot the system, you can use:


echo b | sudo tee /proc/sysrq-trigger


This approach is usually not advised for regular use but can be useful during emergencies.


Best Practices for Rebooting


It is recommended to create a backup of important data before starting a reboot to avoid data loss in case of any unforeseen problems during the reboot. Furthermore, informing users about the upcoming restart can prevent interruptions, particularly on systems with multiple users.


Conclusion


Rebooting a Linux system via the command line is straightforward, with several commands available to suit different needs. The reboot and shutdown commands are the most commonly used, while Systemctl provides a modern approach for systems running systems. Understanding these commands and their options is essential for effective Linux system administration, ensuring reboots are performed safely and efficiently.



Was this answer helpful? #1 #4
 

Did We Miss Out on Something?

Relax, we have you covered. At Go4hosting, we go the extra mile to keep our customers satisfied. We are always looking out for opportunities to offer our customers “extra” with every service. Contact our technical helpdesk and we’d be more than happy to assist you with your Cloud hosting, Colocation Server, VPS hosting, dedicated Server or reseller hosting setup. Get in touch with us and we’d cover all your hosting needs, however bizarre they might be.

Submit your Query

  • I'm not a robot

Browse by ServicesBrowse by Services

Resource Library

What is Cloud Computing

Understand the term cloud computing, the ongoing trend, its playing field, future growth and how industry...

Myths about Cloud Computing

Cloud computing, in the recent years, has become a subject of significant discussion among the industry experts.

Download Now

Did We Miss Out on Something?

Relax, we have you covered. At Go4hosting, we go the extra mile to keep our customers satisfied. We are always looking out for opportunities to offer our customers “extra” with every service. Contact our technical helpdesk and we’d be more than happy to assist you with your Cloud hosting, Colocation Server, VPS hosting, dedicated Server or reseller hosting setup. Get in touch with us and we’d cover all your hosting needs, however bizarre they might be.

Submit Query

Please fill in the form below and we will contact you within 24 hours.