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.
You should read it
- How to install Debian on a computer
- How to upgrade Debian
- How to use the grep command on Debian 10
- How to Install Gradle on Debian 10
- Instructions for using dpkg command on Linux Debian
- Notable changes and additions in Debian 11 'Bullseye'
- Do not destroy the Debian system!
- Debian 10 Buster, New features in Debian 10 Buster
- How to reset the password for sudo in Debian
- 9 best Debian-based Linux distributions
- How to Install and Use Ansible on Debian 10
- How to Install Debian
Maybe you are interested
How to use the file search command on Windows, find saved files
Why is tldr command better than man command in Linux?
Should I use PowerShell or Command Prompt?
What to do when open command window here does not appear?
How to switch users on the Linux command line
How to fix Mac Homebrew error 'zsh: command not found: brew'