How to Reboot Linux System with Command Line

How to Reboot Linux System with Command Line
How to Reboot Linux System with Command Line

Reboot Linux System with Command Line

Whenever you install updates or do certain network tasks, a time comes when you need to Reboot or halt or shut down the system. There are a variety of utilities comes with every Linux system which allows rebooting the system. In this tutorial, you are going to learn how to reboot Linux System with Command-Line.

1. Reboot Linux System

Follow the below instructions to restart the Linux system:

1. Log in to your Linux system with a sudo account.

2. Now type the following command in the terminal and hit Enter:

sudo reboot

or you can also execute the following command:

sudo shutdown -r now

Here executing the above command successfully, your system will start rebooting automatically.

2. Reboot Linux at Specific Time or Schedule Restart

You can schedule a restart or reboot the Linux system at a specific time by using shutdown command with -r flag.

The Basic syntax to schedule a restart is given below:

sudo shutdown –r [TIME_TO_RESTART] [MESSAGE_TO_BROADCAST]

To restart the system at 4:00 am you can run the following command:

sudo shutdown –r 04:00

The output should be:

"How

Similarly to shutdown system at 1:00 pm, you can run below command:

sudo shutdown -r 13:00

You can also broadcast a message when restarting the system:

sudo shutdown -r 13:00 "restarting the system with message"

3. Reboot Linux after Specific Time

You can also reboot the system after some time from the current time. Let’s see some examples:

To reboot the system after 10 minutes you can run the following command:

sudo shutdown -r +10

The output should be:

"How

Similarly to reboot the system after 30 minutes you can run the following command:

sudo shutdown -r +30

4. Cancel the Reboot

After setting reboot you can also cancel it. To cancel the reboot of Linux system you should use -c flag with shutdown command:

sudo shutdown -c

You can also broadcast a message when canceling restart:

sudo shutdown -r 13:00 "canceling restart the system with message"

5. Restart the system with root user

When you are logged in as a root user you can restart the system with the following command:

# /sbin/reboot

or You can restart the system with /sbin/shutdown command:

# /sbin/shutdown -r now

6. Reboot Linux Remotely

You can reboot Linux system remotely using /sbin/reboot or /sbin/shutdown commands.

To reboot the system you can run the following command:

ssh [email protected]_SERVER_ADDRESS.com /sbin/reboot

or

ssh [email protected]_SERVER_ADDRESS.com /sbin/shutdown -r now

Conclusion

You have successfully learned how to Reboot Linux System with command line. If you have any queries regarding this then please don’t forget to comment below.

LEAVE A REPLY

Please enter your comment!
Please enter your name here