How to restart Debian from the command line

s2 0

Linux OS can run for years, not weeks, without a reboot. But sometimes there is a good reason to restart your Linux system after a week or two, depending on the situation. Most of the time there are two main reasons for restarting. First, the reboot will be required if you install any software that requires a reboot to become functional. Second, when upgrading your system or doing some configuration that also requires a reboot. Aside from that, there could be many other reasons to restart. Whatever the reason, you should know how to reboot a system for any changes to take effect.

If you’re using a GUI version of Linux or physically accessing your system, rebooting the system won’t be a problem, but if you’re using a headless version of the operating system or accessing it via SSH and only have command line access. In this case, you should know how to restart a system from the command line.

In this article, we are going to cover various commands for restarting a Debian-based operating system. We will use Debian 10 to describe the procedure mentioned in this article.

  • Using the restart command
  • Use shutdown command
  • Use init command
  • Use proc command

Using the restart command

The fastest way to restart Debian OS is to use the reboot command. It shuts down and then reboots a local host or a remote Debian machine.

To use this command in Debian to reboot. First we need to start the Terminal application in Debian. To do this, go to the activities Tab in the upper left corner of your desktop. Then type in the search bar terminal. When the terminal icon appears, click on it to launch it.

Then enter the following command in the terminal:

$ sudo reboot

It will turn off immediately and then restart the system.

You can also force restart a system if the restart command itself might not work. It’s like pressing the power button on your laptop or PC. Enter the following command in Terminal to force restart your system:

$ reboot -f

Use shutdown command

The shutdown command in Linux, as the name suggests, is used to turn off the system. But if we the –R. Flag with it, we can use it to reboot the system. With this command we also need to add the time argument to indicate when to restart the system. Note that we have to specify the time in minutes.

The syntax of the command to restart would be:

$ sudo shutdown -r +[time]

If the above command is entered with no time argument, the system will restart after one minute with the default settings.

$ sudo shutdown -r


To restart the system immediately, use the following command:

$ sudo shutdown -r now

You can also schedule the restart by defining the time in minutes.

For example, to schedule a restart after 2 minutes, use the following command:

$ sudo shutdown -r +2

To restart at an exact time, e.g. For example, to schedule 2:10 p.m., you can use:

$ sudo shutdown -r 14:10

If you have set up a scheduled restart, but want to cancel it later, you can do this with the –C. Flag. Run the following command in Terminal to cancel a scheduled reboot.

$ sudo shutdown -c

Use init command

Init (short for initialization) is the first process that is started when the system is started. It initializes various processes in a Linux system. You can use it to shut down or restart a Linux. There are several levels of execution (from zero to six) that you can use with the init command to control system behavior. To reboot a system use runlevel 6 followed by the init command as shown below:

$ /sbin/init 6

Using the proc command

When working on a remote server that you do not have physical access to, you sometimes encounter a situation where the standard reboot does not work or takes a long time. In this case we force the kernel to restart with the magic SysRq key. The SysRq key provides a means of sending instructions to the kernel via 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 regularly, only when absolutely necessary.

We have discussed different ways to restart a Debian machine quickly and easily. The four methods discussed above apply to both local and remote computers. All of these commands instantly restart a system. So make sure to save your work before rebooting.

How to restart Debian from the command line