7 Ways to Restart Linux from Terminal
Rebooting Linux from the terminal may seem daunting, but don't worry, it's quite simple once you know the right commands. Rebooting Linux is necessary after updating, troubleshooting, or performing system maintenance. It ensures that changes take effect and keeps the system stable. This is especially true if you are managing a remote Linux system where you can only reboot Linux from the terminal.
Whether you need an immediate reboot, a scheduled reboot, or a forced shutdown, there is a method for every situation. In this article, we will discuss different ways to reboot Linux using the terminal.
1. Use the reboot command
The reboot command safely terminates any running processes. It ensures that ongoing tasks are properly closed before rebooting the system. This helps prevent data loss and maintains system stability. To reboot your Linux system immediately, run the reboot command:
sudo reboot
Provide the appropriate password and press Enter to reboot Linux:
To force an immediate reboot, run the reboot command with the -f option :
sudo reboot -f
This will reboot your system immediately, regardless of any scheduled shutdown commands or running processes.
2. Use the shutdown command
You can use the shutdown command to restart your system immediately or schedule it for a specific time. For example, running the shutdown command with the -r option will restart your Linux system immediately:
sudo shutdown -r now
With the shutdown command, we can schedule a reboot after a specific time by specifying a number of minutes. For example, to reboot a Linux system after 2 hours, run:
sudo shutdown -r +120
If you scheduled a reboot but changed your mind, you can easily cancel it with the -c option :
sudo shutdown -c
3. Use the systemctl command
In modern Linux distributions using systemd, the recommended way to reboot the system is to use the following command:
sudo systemctl reboot
This command will terminate all running processes and safely reboot the system.
4. Using the init command
In older Linux distributions using SysVinit, the system can be rebooted with the following command:
sudo init 6
When you run init 6, the system switches to run level 6, which means the system is ready to reboot. It stops all running processes, unmounts the file systems, and then reboots the system. While this command still works on some systems, you should use the systemctl reboot command for newer Linux versions using systemd.
5. Use the telinit command
The telinit 6 command reboots Linux by instructing init (or systemd on modern systems) to switch to runlevel 6, which triggers a reboot:
sudo telinit 6
This command ensures that the system reboots in a controlled manner by following the proper shutdown procedure.
6. Using REISUB (Magic SysRq Key)
If your Linux system becomes unresponsive, you can safely reboot it using the R, E, I, S, U, B (BUSIER backwards) key sequence, which prevents data corruption. This method sends specific commands to the kernel using the SysRq (System Request) key. To reboot your Linux system using this method, hold down the Alt + SysRq (Print Screen) keys on your keyboard and press each of the following keys in order:
- R : Puts the keyboard in raw mode, taking control away from applications.
- E : Send termination signal to all processes.
- I : Send shutdown signal to all processes.
- S : Force disk sync, ensuring all data is written to the drive.
- U : Remount all file systems in read-only mode, preventing corruption.
- B : Restart the system immediately.
This method is useful when the system is unresponsive but still accepts keyboard input.
7. Reboot Linux via SSH
If you are managing a Linux server remotely and need to reboot, first connect to the server using SSH :
ssh user@your-server-ip
Once connected, you can reboot the system immediately with:
sudo reboot
Similarly, if you need to schedule a reboot, you can use the command:
sudo shutdown -r +10 # Reboots after 10 minutes
You can cancel a scheduled restart at any time by:
sudo shutdown -c
Just make sure you have the necessary permissions to run these commands!
Rebooting Linux from the Terminal is simple once you know the right commands. Whether you need an immediate reboot, a scheduled reboot, or a way to deal with a frozen system, Linux offers a variety of options to suit different situations. While systemctl reboot is the standard for modern distributions, older systems still support init and telinit. For remote management, SSH makes rebooting a server easy. With these methods, you can effectively reboot your system right from the Terminal whenever you need to.
You should read it
- Top 7 best Linux terminal emulators
- How is Arch Linux different from other Linux versions?
- How to use Guake Terminal in Linux
- How to back up and restore Linux Terminal history
- How to install dictionaries in Linux Terminal
- How to use Linux Terminal as a computer
- 6 ways to restart your Windows computer from simple to 'Pro'
- How to play Game Boy games on Linux Terminal
May be interested
- 14 interesting Linux commands in Terminalterminal is a very powerful tool, but it can become 'interesting' through a few bash commands that quantrimang will introduce to you later. let's follow up and find out because some commands are quite useful.
- 6 interesting terminal commands on Macterminal is a handy utility, often found on unix-based computers, such as linux and macos. there are many interesting things to do in the terminal. regardless of your experience, you can use these great terminal commands on mac.
- 18 Interesting Linux Commands in Terminalterminal is a very powerful tool, but it can be made 'interesting' through a few bash commands that tipsmake.com will introduce to you below. let's follow and learn because some commands are quite useful.
- 6 ways to restart your Windows computer from simple to 'Pro'restarting the computer is a task that must be done quite often when the computer is slow, hanging, and installing software. there are many ways to restart your computer, in addition to using the start button to restart your computer, you have 7 other options to apply in different situations.
- 4 quick access to a Terminal in Linuxyou really need a terminal that is always available in linux? here are 4 different ways to quickly access a terminal.
- How to Create and Edit Text File in Linux by Using Terminalthis wikihow teaches you how to use the terminal app in linux to create a text file. after doing so, you can use one of linux's built-in text editors to make changes to the file. open terminal. to do so, click menu, then find the terminal...
- How to spell check in Linux Terminallinux also has a command line spell checker utility in terminal. the utility is called aspell and is installed by default on ubuntu. this is how you can use aspell to check spelling in a terminal.
- How to search Google from Linux terminal with Googlergoogler is a terminal tool that allows you to easily run google searches from your linux terminal, with lots of options to help you find exactly what you're looking for.
- How to create and delete folders in Linux Terminalfolders are essential for your linux operating system because they contain files you may use often or that the system needs to function correctly.
- 8 best free Terminal Emulator apps for Androidterminal emulator applications on android are handy when you want to execute commands within the android operating system just like on linux.