shutdown
Overview
The shutdown
command brings the system down in a secure way. It notifies users, stops processes gracefully, and either halts, powers off, or reboots the system.
Syntax
shutdown [options] [time] [message]
Common Options
Option | Description |
---|---|
-h |
Halt or power off |
-r |
Reboot |
-c |
Cancel pending shutdown |
-k |
Only send warning |
-P |
Power off |
-H |
Halt |
-f |
Force fsck on reboot |
-F |
Skip fsck on reboot |
now |
Immediate shutdown |
+m |
Minutes to wait |
HH:MM |
Specific time |
Key Use Cases
- System maintenance
- Emergency shutdown
- Scheduled reboots
- Power management
- User notification
Examples with Explanations
Example 1: Immediate Shutdown
shutdown -h now
Halt system immediately
Example 2: Scheduled Reboot
shutdown -r +15 "System maintenance in 15 minutes"
Reboot in 15 minutes with message
Example 3: Cancel Shutdown
shutdown -c
Cancel pending shutdown
Understanding Output
System messages: - Broadcast warning - Process termination - Service shutdown - Final system state
Common Usage Patterns
Power off:
shutdown -P now
Delayed shutdown:
shutdown -h +30
Specific time:
shutdown -r 23:00
Security Considerations
- User permissions
- Process termination
- Data integrity
- Service shutdown
- Network connections
Additional Resources
Best Practices
- Notify users
- Schedule maintenance
- Check active processes
- Verify file systems
- Document actions
Process Handling
- SIGTERM signals
- Service shutdown
- Process cleanup
- File system sync
- Hardware shutdown
Safety Checks
- Active users
- Running processes
- Open files
- Network connections
- System services