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

--help
    Displays a help message and exits.

--version
    Displays version information and exits.

--halt
    Halt the machine. (Equivalent to running halt).

--reboot
    Reboot the machine after shutdown.

--force
    Forces immediate shutdown (bypasses the init system). Use with caution!

DESCRIPTION

The poweroff command is used to halt the system and then turn off the power. It's essentially a system shutdown procedure that goes a step further by cutting off the power supply, if the hardware supports it.

By default, poweroff performs a clean shutdown by sending a signal to all processes, unmounting file systems, and stopping all services. It prevents data loss and ensures the system is in a consistent state before powering down.

Often poweroff is a symbolic link to shutdown or systemctl poweroff, inheriting its behavior and arguments. Therefore, the exact actions performed during a poweroff may vary slightly depending on the system's init system (e.g., systemd, SysVinit).

CAVEATS

Using the --force option can lead to data corruption if the system is not in a consistent state. It is generally recommended to avoid this option unless the system is completely unresponsive.

The actual power-off functionality depends on the hardware and BIOS support. Some systems may only halt instead of fully powering off.

EXIT STATUS

The poweroff command returns 0 on success and a non-zero value on failure.

SECURITY CONSIDERATIONS

poweroff usually requires root privileges. Allowing regular users to execute this command directly can pose a security risk.

HISTORY

The poweroff command has existed in Unix-like systems for a long time, dating back to the early days of Unix.
Its primary purpose has always been to provide a simple and standardized way to shut down the system and turn off the power.
The specific implementation and features have evolved over time, especially with the introduction of different init systems like System V init and systemd.

SEE ALSO

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

Copied to clipboard