How to restart a Linux system at the command line

> How to restart Linux system with command line

Reboot Linux system with command line

Each time you install an update or perform a specific network task, you must restart, stop, or shut down the system. Linux systems come with various utilities that allow you to restart your system. In this tutorial, you will learn how to restart a Linux system using the command line.

1. Reboot the Linux system

Follow the instructions below to restart your Linux system.

1. Log in to your Linux system using your sudo account.

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

sudo reboot

Alternatively, you can run the following command:

sudo shutdown -r now

If you execute the above command successfully, the system will automatically start rebooting.

2. Restart Linux at a specific time or schedule a restart

You can schedule a reboot or reboot your Linux system at a specific time. shutdown With command -r National flag.

The basic syntax for scheduling a restart is as follows:

sudo shutdown –r [TIME_TO_RESTART] [MESSAGE_TO_BROADCAST]

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

sudo shutdown –r 04:00

The output looks like this:

How to restart a Linux system at the command line

As well as shutting down the system at 1:00 pm, you can run the following command:

sudo shutdown -r 13:00

You can also broadcast a message when the system restarts.

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

3. Restart Linux after a specific time

You can also restart the system some time after the current time. Let’s look at some examples.

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

sudo shutdown -r +10

The output looks like this:

How to restart a Linux system at the command line

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

sudo shutdown -r +30

4. Cancel the restart

After setting the restart, you can also cancel it. To cancel a Linux system reboot, you must use -c Shutdown command flags:

sudo shutdown -c

You can also broadcast a message when you cancel the restart.

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

5. Restart the system as root user

If you are logged in as the root user, you can restart your system using the following command:

# /sbin/reboot

Or you can restart the system in the following ways /sbin/shutdown command:

# /sbin/shutdown -r now

6. Restart Linux remotely

Linux systems can be rebooted remotely /sbin/reboot Or /sbin/shutdown command.

To restart 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 learned how to restart a Linux system using the command line. If you have any questions about this, don’t forget to comment below.

Sidebar