Operations 3 min read

How to Safely Shut Down Linux with the poweroff Command

Learn how to use the Linux poweroff command to safely shut down the operating system, understand its logging behavior, explore available options such as -n, -w, -d, -i, -h, -f, and see practical examples and related commands for viewing shutdown logs.

Open Source Linux
Open Source Linux
Open Source Linux
How to Safely Shut Down Linux with the poweroff Command

poweroff: Shut Down the System

Function Description:

The poweroff command shuts down the computer operating system and cuts power. Use it when no users are logged in and all data is saved, and you need an immediate shutdown.

The shutdown record is written to the /var/log/wtmp log file.

Command Syntax:

poweroff [options]

Option Meanings:

The meanings of the command options are as follows:

-n : Do not perform sync before shutting down.

-w : Do not actually shut down; only write to /var/log/wtmp.

-d : Do not write the shutdown operation to the /var/log/wtmp log file.

-i : Close all network interfaces before shutting down.

-h : Set all hardware to standby mode before shutting down.

-f : Force shutdown.

Example:

Shut down the computer operating system and cut power:

# poweroff

Additional Knowledge:

How to view the /var/log/wtmp log file in Linux:

last -f /var/log/wtmp  // wtmp is a binary file; use the last command to view

Equivalent to executing:

last
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxUnixsystem shutdownpoweroff
Open Source Linux
Written by

Open Source Linux

Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.