Oct 21, 2023 3 min read

How to Restart Debian From Command Line

Restart Debian through the command line with our step-by-step tutorial. It is a free and open-source OS known for its stability, security etc.

Restart Debian From Command Line
Table of Contents

Introduction

Before we start discussing how to restart Debian from command line, let's briefly understand-What is Debian?

Debian is a free and open-source operating system known for its stability, security, and wide range of software packages. It is one of the oldest and most influential Linux distributions available.

A Linux system like Debian needs to be restarted frequently, especially when new configurations have been made. It also assists you in recovering from temporary problems that may occur at any time. Because most Debian users preferred to control the system via the command line.

In this tutorial, you will understand how to restart Debian from command line. We will also address a few FAQs on how to restart Debian from command line.

Restart Debian From Command Line

There are numerous commands that can quickly restart Debian. The intricacies of these commands are explained below:

Command 1

On the Debian terminal, the "reboot" command is a frequently used command that can be used to restart the system. The command is as follows:

sudo reboot

Note: To reboot the Debian, you must input the password.

Command 2

You can restart the Debian system by using the following command as well as systemctl command, which is frequently used to manage system services:

sudo systemctl reboot

Command 3

By running the command shown below, which restarts the Debian system immediately, you can also restart or reboot the machine.

/sbin/reboot

Command 4

The Debian system can also be restarted quickly from the command line by using the shutdown command with the -r argument and the now command.

shutdown -r now
💡
If you faced error like shutdown: command not found then fix it by exporting /sbin to you path: export PATH=$PATH:/sbin/.

You can use the command to add a delay of a few minutes if you wish to schedule the system restart.

The command listed below will restart the system by indicating that a restart is scheduled for five minutes from now:

shutdown -r +5

Command 5

You can restart the Debian system from the command line by using the command listed below.

sudo init 6

FAQs to Restart Debian from Command Line

Can I use the shutdown command to restart Debian ?

Yes, you can use the shutdown command with the -r option to restart Debian. The command sudo shutdown -r now will initiate an immediate restart.

What is the difference between reboot and shutdown -r now? 

Both commands will restart Debian. However, reboot is a simpler and more concise command, while shutdown -r now provides additional options for scheduling restarts and sending notifications.

How do I schedule a restart using the shutdown command? 

To schedule a restart with the shutdown command, use the -r option followed by the desired restart time. For example, sudo shutdown -r 22:00 will schedule a restart at 10 PM.

Can I cancel a scheduled restart? 

Yes, you can cancel a scheduled restart by using the shutdown command with the -c option. Running sudo shutdown -c will cancel the scheduled restart.

Is there a delay before the system restarts? 

By default, Debian provides a delay of one minute before restarting. During this period, a warning message will be displayed to alert users. You can cancel the restart within this timeframe.

How do I include a custom warning message before restarting? 

To include a custom warning message with the restart command, use the -k option followed by your message. For example, sudo shutdown -r now -k "System restart in progress..." will display the provided message before restarting.

Are there any alternative commands to restart Debian ?

Yes, you can also use the init command with the runlevel option 6 to restart Debian. Run sudo init 6 to initiate a restart.

Conclusion

Linux includes a number of command-line options for restarting the system. To restart the system, simply type sudo reboot. The Debian system can also be restarted using the systemctl, sbin, shutdown, or init commands. The commands are already provided in the above-mentioned guidelines, and you can select the one that works best for you.

If you have any queries or doubts, please leave them in the comment below. We'll be happy to address them.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Tutorials - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.