Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

How to Restart Debian Using the Command Line

Learn about Debian, including Use the Command Reboot, key uses, practical steps, common issues, and answers to frequently asked questions.

Table of Contents

This practical guide explains how to restart debian using the command line with clear steps and useful context. It also covers common requirements, potential problems, and the details that can help you get better results.

Note: Debian 11 is being used to describe the process in this article.

Use the Command Reboot

The fastest way to restart Debian is to use the reboot command. Command to power off and then do a reboot of the local server or the remote Debian machine. You must have root privileges on the system to restart it. To become the root user on Debian, use the following command:

su -

To use this command to restart Debian, first launch the Terminal application in Debian. To do so, go to the Activities tab located at the top left corner of the screen. Then in the search bar, type terminal. When the Terminal icon appears, click on it to launch the tool.

Then, in Terminal, type the following command:

$ reboot

It will immediately power off and then reboot the system.

You can also force a system reboot if the reboot command itself doesn't work. It is similar to pressing the power button of a laptop or PC. Enter the following command in Terminal to force restart the system:

$ reboot -f

Use the Shutdown Command

The shutdown command in Linux as its name implies is used to shut down the system. But if you use the –r flag with it, you can use the command to reboot the system. Using this command, you must also add a time argument to indicate when to restart the system. Please note that time must be mentioned in minutes.

The syntax of the restart command would be:

$ shutdown -r +[time]

When the above command is entered without any time argument, the system will reboot after one minute using default settings.

$ shutdown -r

To reboot the system immediately, use the following command:

$ shutdown -r now

You can also schedule a restart by specifying the time in minutes.

For example, to schedule a reboot 2 minutes from now, use the command below:

$ shutdown -r +2

To schedule a restart at an exact time, say, 2:10 pm, you can use:

$ shutdown -r 14:10

If you have a scheduled restart set up, but then want to cancel it, you can do so using the –c flag. Run the following command in Terminal to cancel the scheduled reboot.

$ shutdown -c

Using the Init. Command

Init (short for initialization) is the first process that starts when the system boots. It initializes various processes in the Linux system. You can use it to shut down or restart Linux. There are different run levels (from 0 to 6) that you can use with the init command to control system behavior. To reboot the system, use run level 6 followed by the init command as shown below:

$ /sbin/init 6

Using the Proc. Command

Sometimes while working on a remote server that you don't have physical access to, you come across a situation where the standard reboot doesn't work or takes a long time. In that case, we will force the kernel to reboot using the magic SysRq key. The SysRq key provides a way to send instructions to the kernel through the /proc virtual file system.

To use the SysRq key, use the following command:

$ echo 1 > /proc/sys/kernel/sysrq

Then use the following command to reboot the system:

$ echo b > /proc/sysrq-trigger

This method should not be used often, but only when absolutely necessary.

The article discussed different ways to reboot Debian machine easily and quickly. The 4 methods explained above apply to both local and remote machines. All of these commands immediately reboot the system, so make sure to save your work before doing the reboot.

Conclusion

Understanding Debian makes it easier to compare options, avoid common mistakes, and apply the information in this guide more effectively. Review the relevant requirements before making changes or choosing a solution.

FAQ

How do you restart debian using the command line?

Follow the steps in this guide in order, confirm the required settings or tools, and verify the result before making additional changes.

Is it safe to restart debian using the command line?

It is generally safe when you follow the recommended instructions, use trusted tools, and avoid changing settings you do not understand.

What should you do if the process does not work?

Recheck the requirements, restart the device or application when appropriate, and review each step for missed settings or compatibility issues.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.