Quick Linux Desktop Shutdown and Custom Alias Setup
Quick reference for shutting down Linux systems via terminal - both standard commands and how to create a custom shortcut (alias ‘sd’) for faster access. Added this because I always forget the exact shutdown commands and the alias setup steps.
The quickest ways to shut down your Linux system via terminal:
- shutdown now - safest method, properly saves data
- poweroff - short command, similar to shutdown now
- init 0 - classic Unix command, works on all systems
- halt - stops all processes and system
Create Custom Alias
To set up a convenient shutdown alias:
- Open .bashrc:
nano ~/.bashrc
- Add at the end:
alias sd='shutdown now'
- Save file: CTRL + O, ENTER, CTRL + X
- Reload .bashrc:
source ~/.bashrc
Now you can simply type sd to shutdown your system. Pro tip: Consider using alias sd=’sudo shutdown now’ if you always need root privileges.