Managing a Linux system’s power state correctly ensures data integrity and gives users time to save work before the machine goes offline. In this guide, you’ll learn how to:Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
- Reboot or power off immediately with
systemctl - Force a reset when the system is unresponsive
- Schedule shutdowns or reboots with
shutdown - Notify logged-in users in advance
1. Managing System States with systemctl
Most modern Linux distributions use systemd, andsystemctl is the primary tool to control power states.
All
systemctl commands require root privileges. Prepend sudo if you’re not running as root.| Action | As Root | As Non-Root User |
|---|---|---|
| Reboot now | # systemctl reboot | $ sudo systemctl reboot |
| Power off now | # systemctl poweroff | $ sudo systemctl poweroff |
Reboot
Power Off (Shutdown)
2. Forcing a Reboot or Shutdown
If your system is hung or won’t shut down cleanly, you can force the operation. Use these commands sparingly—they bypass the normal shutdown sequence and risk data loss.Forced shutdowns do not allow applications to close gracefully. Always try a standard reboot first.
| Severity | Command |
|---|---|
| Single force | sudo systemctl reboot --forcesudo systemctl poweroff --force |
| Immediate reset | sudo systemctl reboot --force --forcesudo systemctl poweroff --force --force |
3. Scheduling with shutdown
Theshutdown utility lets you schedule a shutdown or reboot and broadcast a warning message to all users.
| Task | Command Syntax |
|---|---|
| Shutdown at specific time | sudo shutdown HH:MM |
| Shutdown after a delay | sudo shutdown +<minutes> |
| Reboot instead of shutdown | Add -r: sudo shutdown -r HH:MM |
| Reboot after a delay | sudo shutdown -r +<minutes> |
Schedule by Clock Time
0000–2359.)
Schedule by Delay
Reboot with shutdown
4. Notifying Logged-In Users
To give users advance notice, append a quoted message at the end of theshutdown command: