How to Restart Debian Using the Command Line

In this article, Tipsmake will cover various commands for rebooting a Debian-based operating system.

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.

4 ★ | 2 Vote

May be interested

  • Forget the GUI, the Command Line is returningForget the GUI, the Command Line is returning
    managing windows to the cloud also means a command line revival with powershell and bash.
  • How to install Debian on a computerHow to install Debian on a computer
    debian is one of the oldest and most popular linux distributions, but mainly for the technically savvy. in fact, debian is very easy to install. here's how to get debian up and running on your computer.
  • 5 reasons why people love the Linux command line5 reasons why people love the Linux command line
    many people are afraid of the command line. they see it as something for software developers or geeks. but the command line is merely another way of interacting with a pc, and there are some tasks that are very easy to do with the cli.
  • 5 best command line emulation software for Windows 105 best command line emulation software for Windows 10
    currently, users can get a shell within windows 10, but many still prefer the more configurable command line emulator applications. so this article will introduce you to five of the best command line emulation software for windows 10.
  • How to reset the password for sudo in DebianHow to reset the password for sudo in Debian
    the user password is changed in debian using the passwd command. in this article, tipsmake.com will explain how root users can change their own passwords on debian servers.
  • How to use the Linux command line on Android with TermuxHow to use the Linux command line on Android with Termux
    android is a very operating system 'capacity with more and more desktop accessibility applications. however, sometimes you want to make some things on android that can be as easy as desktop. fortunately, you can use the termux tool, which builds on the existing infrastructure and provides a command line environment that allows you to install real linux applications on your android device.
  • How to create a command line program in Python with ClickHow to create a command line program in Python with Click
    click is a python package to write command line interfaces with as little code as possible. this article will show you how to use click to create the command line program.
  • 10 tips for using Command Line Windows 10 users should know10 tips for using Command Line Windows 10 users should know
    you can use the cmd command to perform some tasks that normally only use mouse, drag and click. the cmd command is also quite useful when you need to create scripts and automated tasks.
  • 12 best command line emulators for Windows12 best command line emulators for Windows
    nowadays, users can get a shell inside windows 10, but many still prefer configurable command line emulators. therefore, this article will introduce to you five of the best command line emulator software for windows 10.
  • How to upgrade DebianHow to upgrade Debian
    in every two year period, debian will have no changes. program and feature versions remain the same during this time.