- To shut down immediately: `sudo shutdown -h now`
- To shut down after a delay: `sudo shutdown -h +m` (replace m with minutes)
- To shut down at a specific time: `sudo shutdown -h HH:MM` (24-hour format)
### b) Restart:
- To restart immediately: `sudo shutdown -r now` or `sudo reboot`
- To restart after a delay: `sudo shutdown -r +m` (replace m with minutes)
- To restart at a specific time: `sudo shutdown -r HH:MM` (24-hour format)
### c) Cancel a scheduled shutdown or restart:
-`sudo shutdown -c`
## 2. Using systemctl (for systemd-based distributions):
- Shutdown: `sudo systemctl poweroff`
- Restart: `sudo systemctl reboot`
## 3. Legacy commands (still work on most systems):
- Shutdown: `sudo halt` or `sudo poweroff`
- Restart: `sudo reboot`
## 4. GUI Methods:
Most desktop environments (GNOME, KDE, Xfce, etc.) have a menu option for shutting down or restarting. Usually found in the main menu or by clicking on the user name/icon.
## 5. Emergency Immediate Shutdown:
In case of an unresponsive system, you can use the magic SysRq key combinations: