There are several commands you can use to shut down Linux from the terminal. You can shut down your system immediately, after a certain grace period, or at a specific time. All these methods require you to open the terminal with Ctrl + Alt + T
. You will also need to enter your password to confirm the command.
Immediate Shutdown
To shut down Linux immediately, use the command:
sudo shutdown -h now
Enter your password.
Scheduled Shutdown at a Specific Time
To shut down Linux at a specific time, use the command:
sudo shutdown -P 3:00
Enter your password. You can replace 3:00
with the specific time you want Linux to turn off.
Delayed Shutdown
To shut down Linux after a certain period, use the command:
sudo shutdown -P +30
Enter your password. Replace +30
with the number of minutes you want Linux to wait before shutting down.
Cancel Shutdown
At any time, you can cancel these shutdown commands by entering:
sudo shutdown -c
Final Tips
If you need a refresher, you can review any shutdown commands via the terminal to see the history. Use these commands for additional information:
- To see the history of shutdown commands:
last shutdown
- To get a more detailed list of when your Linux computer was turned on and for how long:
last reboot
- To see a list of how long your computer was turned off:
last -x shutdown