Skip to content

hostnamectl | Cheatsheet


Show current hostname settings

hostnamectl status 

Get hostname

hostnamectl hostname

Set hostname

hostnamectl hostname <hostname>

hostnamectl status –json=pretty

hostnamectl status --json=pretty
{
        "Hostname" : "nr1",
        "StaticHostname" : "nr1",
        "PrettyHostname" : null,
        "DefaultHostname" : "localhost",
        "HostnameSource" : "static",
        "IconName" : "computer-laptop",
        "Chassis" : "laptop",
        "Deployment" : null,
        "Location" : null,
        "KernelName" : "Linux",
        "KernelRelease" : "6.1.0-31-amd64",
        "KernelVersion" : "#1 SMP PREEMPT_DYNAMIC Debian 6.1.128-1 (2025-02-07)",
        "OperatingSystemPrettyName" : "Debian GNU/Linux 12 (bookworm)",
        "OperatingSystemCPEName" : null,
        "OperatingSystemHomeURL" : "https://www.debian.org/",
        "HardwareVendor" : "SAMSUNG ELECTRONICS CO., LTD.",
        "HardwareModel" : "R530/R730",
        "HardwareSerial" : null,
        "FirmwareVersion" : "06JD.M021.20100628.KSJ",
        "ProductUUID" : null
}