With many of you, it will surely have happened at least once to turn off your Linux PC in a brutal way by pressing the on/off button, perhaps because of some system crash. In this guide, however, we will explain how to force shutdown of Linux using 3 simple solutions.
Before going into the tutorial, we wanted to point out that when you force a Linux computer to shut down (but also with other operating systems), data may be lost.
For example, if you were writing a document without automatic saving enabled, you will surely lose the content if the PC crashes. Therefore, we advise you to regularly backup your data to avoid unpleasant incidents.
How to force shutdown of Linux: first method
The first solution to shut down a Linux PC is to simply use the poweroff command. The latter immediately shuts down the system without warning. However, in order to use this command, you need to open a terminal window in TTY mode. To do this, get root access via sudo -s and press Enter and then give the poweroff command.
In case you can’t access TTY, because maybe you’re using a remote connection, you can get root on the SSH remote console with su – or sudo -s and then typing poweroff.
How to force shutdown of Linux: second method
Restarting is another solution to regaining control of a Linux PC. It is also an excellent alternative to the method seen a while ago because sometimes the poweroff does not work properly. So, open the terminal and use the command sudo reboot or su – and reboot. Alternatively, you can also completely shut down the system instead of restarting it using an option: sudo reboot -f.
How to force shutdown of Linux: third method
The third and last solution to restore the correct functioning of your Linux computer is to use Systemd. One of the most significant advantages of using this tool is that it can be used in different ways since the command line syntax is very simple.
For example, if you want to turn off the machine and you can’t use the poweroff or reboot commands, then you can rely on Systemd. That said, open the terminal and use the sudo systemctl poweroff command to shut down the computer. Alternatively, you can take advantage of – and systemctl poweroff within an SSH terminal.
If you fail to execute the shutdown command correctly, then you can try restarting the Linux PC again using Systemd. To do this, open the terminal and type the command sudo systemctl reboot. If you can’t access the TTY mode to reboot, then try running su – and then systemctl reboot first.
Doubts or problems? We help you
If you still have any doubt or suggestions related to this article then feel free to live a comment in the box below or contact us via our dedicated page.