{
    "mode": "man",
    "parameter": "systemd-ac-power",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/systemd-ac-power/1/json",
    "generated": "2026-10-23T06:48:25Z",
    "synopsis": "systemd-ac-power [OPTIONS...]",
    "sections": {
        "NAME": {
            "content": "systemd-ac-power - Report whether we are connected to an external power source\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "systemd-ac-power [OPTIONS...]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "systemd-ac-power may be used to check whether the system is running on AC power or not. By\ndefault it will simply return success (if we can detect that we are running on AC power) or\nfailure, with no output. This can be useful for example to debug ConditionACPower= (see\nsystemd.unit(5)).\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "The following options are understood:\n",
            "subsections": [
                {
                    "name": "-v --verbose",
                    "content": "Show result as text instead of just returning success or failure.\n\nAdded in version 253.\n",
                    "flag": "-v",
                    "long": "--verbose"
                },
                {
                    "name": "--low",
                    "content": "Instead of showing AC power state, show low battery state. In this case will return zero\nif all batteries are currently discharging and below 5% of maximum charge. Returns\nnon-zero otherwise.\n\nAdded in version 254.\n",
                    "long": "--low"
                },
                {
                    "name": "-h --help",
                    "content": "Print a short help text and exit.\n",
                    "flag": "-h",
                    "long": "--help"
                },
                {
                    "name": "--version",
                    "content": "Print a short version string and exit.\n",
                    "long": "--version"
                }
            ]
        },
        "EXIT STATUS": {
            "content": "On success (running on AC power), 0 is returned, a non-zero failure code otherwise.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "systemd(1)\n\nsystemd 255                                                                      SYSTEMD-AC-POWER(1)",
            "subsections": []
        }
    },
    "summary": "systemd-ac-power - Report whether we are connected to an external power source",
    "flags": [
        {
            "flag": "-v",
            "long": "--verbose",
            "arg": null,
            "description": "Show result as text instead of just returning success or failure. Added in version 253."
        },
        {
            "flag": "",
            "long": "--low",
            "arg": null,
            "description": "Instead of showing AC power state, show low battery state. In this case will return zero if all batteries are currently discharging and below 5% of maximum charge. Returns non-zero otherwise. Added in version 254."
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Print a short help text and exit."
        },
        {
            "flag": "",
            "long": "--version",
            "arg": null,
            "description": "Print a short version string and exit."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "systemd",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/systemd/1/json"
        },
        {
            "name": "SYSTEMD-AC-POWER",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/SYSTEMD-AC-POWER/1/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "Report whether the computer is connected to an external power source.",
        "examples": [
            {
                "description": "Silently check and return a 0 status code when running on AC power, and a non-zero code otherwise",
                "command": "systemd-ac-power"
            },
            {
                "description": "Additionally print `yes` or `no` to `stdout`",
                "command": "systemd-ac-power {{-v|--verbose}}"
            }
        ]
    }
}