{
    "mode": "info",
    "parameter": "systemd-inhibit",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/info/systemd-inhibit/json",
    "generated": "2026-07-05T13:00:24Z",
    "synopsis": "systemd-inhibit [OPTIONS...] [COMMAND] [ARGUMENTS...]\nsystemd-inhibit [OPTIONS...] --list",
    "sections": {
        "NAME": {
            "content": "systemd-inhibit - Execute a program with an inhibition lock taken\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "systemd-inhibit [OPTIONS...] [COMMAND] [ARGUMENTS...]\n\nsystemd-inhibit [OPTIONS...] --list\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "systemd-inhibit may be used to execute a program with a shutdown,\nsleep, or idle inhibitor lock taken. The lock will be acquired before\nthe specified command line is executed and released afterwards.\n\nInhibitor locks may be used to block or delay system sleep and shutdown\nrequests from the user, as well as automatic idle handling of the OS.\nThis is useful to avoid system suspends while an optical disc is being\nrecorded, or similar operations that should not be interrupted.\n\nFor more information see the Inhibitor Lock Developer Documentation[1].\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "The following options are understood:\n\n--what=\nTakes a colon-separated list of one or more operations to inhibit:\n\"shutdown\", \"sleep\", \"idle\", \"handle-power-key\",\n\"handle-suspend-key\", \"handle-hibernate-key\", \"handle-lid-switch\",\nfor inhibiting reboot/power-off/halt/kexec, suspending/hibernating,\nthe automatic idle detection, or the low-level handling of the\npower/sleep key and the lid switch, respectively. If omitted,\ndefaults to \"idle:sleep:shutdown\".\n\n--who=\nTakes a short, human-readable descriptive string for the program\ntaking the lock. If not passed, defaults to the command line\nstring.\n\n--why=\nTakes a short, human-readable descriptive string for the reason for\ntaking the lock. Defaults to \"Unknown reason\".\n\n--mode=\nTakes either \"block\" or \"delay\" and describes how the lock is\napplied. If \"block\" is used (the default), the lock prohibits any\nof the requested operations without time limit, and only privileged\nusers may override it. If \"delay\" is used, the lock can only delay\nthe requested operations for a limited time. If the time elapses,\nthe lock is ignored and the operation executed. The time limit may\nbe specified in logind.conf(5). Note that \"delay\" is only available\nfor \"sleep\" and \"shutdown\".\n",
            "subsections": [
                {
                    "name": "--list",
                    "content": "Lists all active inhibition locks instead of acquiring one.\n",
                    "long": "--list"
                },
                {
                    "name": "--no-pager",
                    "content": "Do not pipe output into a pager.\n",
                    "long": "--no-pager"
                },
                {
                    "name": "--no-legend",
                    "content": "Do not print the legend, i.e. column headers and the footer with\nhints.\n",
                    "long": "--no-legend"
                },
                {
                    "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": "Returns the exit status of the executed program.\n",
            "subsections": []
        },
        "EXAMPLE": {
            "content": "# systemd-inhibit wodim foobar.iso\n\nThis burns the ISO image foobar.iso on a CD using wodim(1), and\ninhibits system sleeping, shutdown and idle while doing so.\n",
            "subsections": []
        },
        "ENVIRONMENT": {
            "content": "$SYSTEMDLOGLEVEL\nThe maximum log level of emitted messages (messages with a higher\nlog level, i.e. less important ones, will be suppressed). Either\none of (in order of decreasing importance) emerg, alert, crit, err,\nwarning, notice, info, debug, or an integer in the range 0...7. See\nsyslog(3) for more information.\n\n$SYSTEMDLOGCOLOR\nA boolean. If true, messages written to the tty will be colored\naccording to priority.\n\nThis setting is only useful when messages are written directly to\nthe terminal, because journalctl(1) and other tools that display\nlogs will color messages based on the log level on their own.\n\n$SYSTEMDLOGTIME\nA boolean. If true, console log messages will be prefixed with a\ntimestamp.\n\nThis setting is only useful when messages are written directly to\nthe terminal or a file, because journalctl(1) and other tools that\ndisplay logs will attach timestamps based on the entry metadata on\ntheir own.\n\n$SYSTEMDLOGLOCATION\nA boolean. If true, messages will be prefixed with a filename and\nline number in the source code where the message originates.\n\nNote that the log location is often attached as metadata to journal\nentries anyway. Including it directly in the message text can\nnevertheless be convenient when debugging programs.\n\n$SYSTEMDLOGTID\nA boolean. If true, messages will be prefixed with the current\nnumerical thread ID (TID).\n\nNote that the this information is attached as metadata to journal\nentries anyway. Including it directly in the message text can\nnevertheless be convenient when debugging programs.\n\n$SYSTEMDLOGTARGET\nThe destination for log messages. One of console (log to the\nattached tty), console-prefixed (log to the attached tty but with\nprefixes encoding the log level and \"facility\", see syslog(3), kmsg\n(log to the kernel circular log buffer), journal (log to the\njournal), journal-or-kmsg (log to the journal if available, and to\nkmsg otherwise), auto (determine the appropriate log target\nautomatically, the default), null (disable log output).\n\n$SYSTEMDPAGER\nPager to use when --no-pager is not given; overrides $PAGER. If\nneither $SYSTEMDPAGER nor $PAGER are set, a set of well-known\npager implementations are tried in turn, including less(1) and\nmore(1), until one is found. If no pager implementation is\ndiscovered no pager is invoked. Setting this environment variable\nto an empty string or the value \"cat\" is equivalent to passing\n--no-pager.\n\n$SYSTEMDLESS\nOverride the options passed to less (by default \"FRSXMK\").\n\nUsers might want to change two options in particular:\n\nK\nThis option instructs the pager to exit immediately when Ctrl+C\nis pressed. To allow less to handle Ctrl+C itself to switch\nback to the pager command prompt, unset this option.\n\nIf the value of $SYSTEMDLESS does not include \"K\", and the\npager that is invoked is less, Ctrl+C will be ignored by the\nexecutable, and needs to be handled by the pager.\n\nX\nThis option instructs the pager to not send termcap\ninitialization and deinitialization strings to the terminal. It\nis set by default to allow command output to remain visible in\nthe terminal even after the pager exits. Nevertheless, this\nprevents some pager functionality from working, in particular\npaged output cannot be scrolled with the mouse.\n\nSee less(1) for more discussion.\n\n$SYSTEMDLESSCHARSET\nOverride the charset passed to less (by default \"utf-8\", if the\ninvoking terminal is determined to be UTF-8 compatible).\n\n$SYSTEMDPAGERSECURE\nTakes a boolean argument. When true, the \"secure\" mode of the pager\nis enabled; if false, disabled. If $SYSTEMDPAGERSECURE is not set\nat all, secure mode is enabled if the effective UID is not the same\nas the owner of the login session, see geteuid(2) and\nsdpidgetowneruid(3). In secure mode, LESSSECURE=1 will be set\nwhen invoking the pager, and the pager shall disable commands that\nopen or create new files or start new subprocesses. When\n$SYSTEMDPAGERSECURE is not set at all, pagers which are not known\nto implement secure mode will not be used. (Currently only less(1)\nimplements secure mode.)\n\nNote: when commands are invoked with elevated privileges, for\nexample under sudo(8) or pkexec(1), care must be taken to ensure\nthat unintended interactive features are not enabled. \"Secure\" mode\nfor the pager may be enabled automatically as describe above.\nSetting SYSTEMDPAGERSECURE=0 or not removing it from the inherited\nenvironment allows the user to invoke arbitrary commands. Note that\nif the $SYSTEMDPAGER or $PAGER variables are to be honoured,\n$SYSTEMDPAGERSECURE must be set too. It might be reasonable to\ncompletely disable the pager using --no-pager instead.\n\n$SYSTEMDCOLORS\nTakes a boolean argument. When true, systemd and related utilities\nwill use colors in their output, otherwise the output will be\nmonochrome. Additionally, the variable can take one of the\nfollowing special values: \"16\", \"256\" to restrict the use of colors\nto the base 16 or 256 ANSI colors, respectively. This can be\nspecified to override the automatic decision based on $TERM and\nwhat the console is connected to.\n\n$SYSTEMDURLIFY\nThe value must be a boolean. Controls whether clickable links\nshould be generated in the output for terminal emulators supporting\nthis. This can be specified to override the decision that systemd\nmakes based on $TERM and other conditions.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "systemd(1), logind.conf(5)\n",
            "subsections": []
        },
        "NOTES": {
            "content": "1. Inhibitor Lock Developer Documentation\nhttps://www.freedesktop.org/wiki/Software/systemd/inhibit\n\nsystemd 249                                                 SYSTEMD-INHIBIT(1)",
            "subsections": []
        }
    },
    "summary": "systemd-inhibit - Execute a program with an inhibition lock taken",
    "flags": [
        {
            "flag": "",
            "long": "--list",
            "arg": null,
            "description": "Lists all active inhibition locks instead of acquiring one."
        },
        {
            "flag": "",
            "long": "--no-pager",
            "arg": null,
            "description": "Do not pipe output into a pager."
        },
        {
            "flag": "",
            "long": "--no-legend",
            "arg": null,
            "description": "Do not print the legend, i.e. column headers and the footer with hints."
        },
        {
            "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": [
        "# systemd-inhibit wodim foobar.iso",
        "This burns the ISO image foobar.iso on a CD using wodim(1), and",
        "inhibits system sleeping, shutdown and idle while doing so."
    ],
    "see_also": [
        {
            "name": "systemd",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/systemd/1/json"
        },
        {
            "name": "logind.conf",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/logind.conf/5/json"
        }
    ]
}