LinuxCommandLibrary

poweroff

Shut down the computer

TLDR

Power off the system

$ poweroff
copy

Halt the system (same as halt)
$ poweroff --halt
copy

Reboot the system (same as reboot)
$ poweroff --reboot
copy

Shut down immediately without contacting the system manager
$ poweroff [[-f|--force]]
copy

Write the wtmp shutdown entry without shutting down the system
$ poweroff [[-w|--wtmp-only]]
copy

SYNOPSIS

poweroff [OPTIONS]

PARAMETERS

-f, --force
    Forces an immediate shutdown without gracefully terminating processes, synchronizing filesystems, or sending warnings.
Use with extreme caution as it can lead to data loss or filesystem corruption.


--no-sync
    Prevents synchronizing disk writes to physical storage before shutdown.
This option is very dangerous and should only be used in specific, critical situations where data integrity is secondary to speed, as it risks significant data loss.


-w, --wall-message=MESSAGE
    Specifies a message to broadcast to all logged-in users before initiating the shutdown.

--no-wall
    Suppresses the default broadcast of a warning message to users about the impending shutdown.

--verbose
    Displays more detailed information about the shutdown process as it unfolds.

DESCRIPTION

The poweroff command is used to safely shut down and completely power off a Linux system. It orchestrates a controlled shutdown process, ensuring all running processes are gracefully terminated, open files are closed, and filesystems are synchronized to disk. This meticulous procedure aims to bring the system to a stable, consistent state before cutting power, thereby preventing data corruption and ensuring system integrity. On modern Linux distributions, poweroff is commonly implemented as a symbolic link to systemctl poweroff or a script that invokes shutdown -P now. This integration leverages the system's init system (like systemd) for robust and consistent power management. Executing poweroff typically requires root privileges.

CAVEATS

Important Considerations:
1. Executing poweroff requires root privileges.
2. On modern systems, poweroff is often a symlink to systemctl poweroff or a script invoking shutdown -P now. Its exact behavior and available options might therefore be influenced by systemd or the shutdown command's underlying implementation.
3. Using options like --force or --no-sync can lead to irreversible data loss or filesystem corruption if not used correctly.

PERMISSIONS

Executing poweroff requires elevated privileges, typically the root user or a user with sudo access. Attempting to run it without sufficient permissions will result in an 'Operation not permitted' error.

GRACEFUL SHUTDOWN

By default, poweroff attempts a graceful shutdown, giving processes time to terminate and filesystems to synchronize. This is the safest way to shut down a system and prevent data corruption, making it the recommended method for regular system shutdowns.

HISTORY

The poweroff command has been a fundamental part of Unix-like operating systems for decades, providing a direct method to instruct the system to power down. Historically, it was often part of the sysvinit toolset. With the widespread adoption of systemd as the primary init system in many modern Linux distributions, poweroff is now commonly implemented as a symbolic link to systemctl poweroff. This transition ensures that power management operations are seamlessly integrated with systemd's service and process management, providing a unified and consistent control interface while maintaining the command's familiar usage.

SEE ALSO

reboot(8), halt(8), shutdown(8), systemctl(1)

Copied to clipboard