{
    "mode": "man",
    "parameter": "runlevel",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/runlevel/8/json",
    "generated": "2026-06-03T00:20:30Z",
    "synopsis": "runlevel [options...]",
    "sections": {
        "NAME": {
            "content": "runlevel - Print previous and current SysV runlevel\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "runlevel [options...]\n",
            "subsections": []
        },
        "OVERVIEW": {
            "content": "\"Runlevels\" are an obsolete way to start and stop groups of services used in SysV init.\nsystemd provides a compatibility layer that maps runlevels to targets, and associated\nbinaries like runlevel. Nevertheless, only one runlevel can be \"active\" at a given time,\nwhile systemd can activate multiple targets concurrently, so the mapping to runlevels is\nconfusing and only approximate. Runlevels should not be used in new code, and are mostly\nuseful as a shorthand way to refer the matching systemd targets in kernel boot parameters.\n",
            "subsections": [
                {
                    "name": "Table 1. Mapping between runlevels and systemd targets",
                    "content": "┌─────────┬───────────────────┐\n│Runlevel │ Target            │\n├─────────┼───────────────────┤\n│0        │ poweroff.target   │\n├─────────┼───────────────────┤\n│1        │ rescue.target     │\n├─────────┼───────────────────┤\n│2, 3, 4  │ multi-user.target │\n├─────────┼───────────────────┤\n│5        │ graphical.target  │\n├─────────┼───────────────────┤\n│6        │ reboot.target     │\n└─────────┴───────────────────┘\n"
                }
            ]
        },
        "DESCRIPTION": {
            "content": "runlevel prints the previous and current SysV runlevel if they are known.\n\nThe two runlevel characters are separated by a single space character. If a runlevel cannot\nbe determined, N is printed instead. If neither can be determined, the word \"unknown\" is\nprinted.\n\nUnless overridden in the environment, this will check the utmp database for recent runlevel\nchanges.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "The following option is understood:\n",
            "subsections": [
                {
                    "name": "--help",
                    "content": "Print a short help text and exit.\n",
                    "long": "--help"
                }
            ]
        },
        "EXIT STATUS": {
            "content": "If one or both runlevels could be determined, 0 is returned, a non-zero failure code\notherwise.\n",
            "subsections": []
        },
        "ENVIRONMENT": {
            "content": "$RUNLEVEL\nIf $RUNLEVEL is set, runlevel will print this value as current runlevel and ignore utmp.\n\n$PREVLEVEL\nIf $PREVLEVEL is set, runlevel will print this value as previous runlevel and ignore\nutmp.\n",
            "subsections": []
        },
        "FILES": {
            "content": "/run/utmp\nThe utmp database runlevel reads the previous and current runlevel from.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "systemd(1), systemd.target(5), systemctl(1)\n\n\n\nsystemd 249                                                                              RUNLEVEL(8)",
            "subsections": []
        }
    },
    "summary": "runlevel - Print previous and current SysV runlevel",
    "flags": [
        {
            "flag": "",
            "long": "--help",
            "arg": null,
            "description": "Print a short help text and exit."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "systemd",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/systemd/1/json"
        },
        {
            "name": "systemd.target",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/systemd.target/5/json"
        },
        {
            "name": "systemctl",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/systemctl/1/json"
        }
    ],
    "tldr": {
        "source": "official",
        "description": "SysV runlevel utility.",
        "examples": [
            {
                "description": "Return previous and current SysV runlevel",
                "command": "runlevel"
            },
            {
                "description": "Display help",
                "command": "runlevel --help"
            }
        ]
    }
}