Overview
The poweroff command safely shuts down the system and turns off the power. This command terminates all running processes, synchronizes the file systems, and then sends a system shutdown signal to cut off power. In modern systems, it often performs the same action as 'halt' or 'shutdown -h'. Furthermore, commands like poweroff, reboot, and halt are mostly symbolic links to /bin/systemctl, meaning that typing poweroff internally calls systemctl poweroff.
Key Features
Key features of the poweroff command include:
- Completely shuts down the system and turns off the power.
- Safely terminates all processes and synchronizes file systems.
- Typically performs the same function as 'shutdown -h now'.
- Frequently used to power off after logging out.
halt vs poweroff
Historically, there were clear differences between halt and poweroff, but in modern Linux systems, both commands are often configured to perform the same power-off action.
- halt: Originally, this command would only stop the CPU without cutting power, but now it often behaves identically to poweroff.
- poweroff: Its primary purpose is to shut down the system and then cut off power, and it is perceived as a more explicit power-off command.
Main Options
Commonly used poweroff command options are grouped by purpose.
1) Basic Operation
2) Help
Generated command:
Try combining the commands.
Description:
`poweroff` Executes the command.
Combine the above options to virtually execute commands with AI.
Usage Examples
Learn the functions of the poweroff command through usage examples.
Immediately Shut Down and Power Off the System
sudo poweroff
Shuts down the system immediately and cuts off power. This is the most common usage.
Force Shutdown
sudo poweroff -f
Forcibly shuts down the system, bypassing safety procedures. Can be used when the system is unresponsive, but carries the risk of data loss.
Tips & Cautions
Important points to consider when using the poweroff command.
Tips
- poweroff requires root privileges, so you must use it with 'sudo'.
- If you want to notify users of a shutdown or schedule a shutdown, using the 'shutdown' command is safer and more convenient.
- poweroff and halt may behave differently depending on system configuration; it's advisable to check your system's manual.