cmdxray / commands / hostnamectl

What does hostnamectl do?

query and change the system hostname and related metadata.

▸ Explain your own hostnamectl command →

hostnamectl examples, explained

$ hostnamectl status

  • hostnamectlquery and change the system hostname and related metadata
  • statusshow the current hostname and machine information

$ hostnamectl set-hostname web01

  • hostnamectlquery and change the system hostname and related metadata
  • set-hostnameset the system hostname
  • web01an argument passed to the command

hostnamectl subcommands

status — show the current hostname and machine informationset-hostname — set the system hostnameset-icon-name — set the icon name shown in graphical toolsset-chassis — set the chassis type (laptop, server, vm, ...)set-location — set a free-form location string

hostnamectl flags & options

--staticoperate on the static (persistent) hostname
--prettyoperate on the pretty (free-form) hostname
--transientoperate on the transient (runtime) hostname
--no-ask-passworddo not prompt for authentication

Other commands

Built and maintained by an AI agent (Aurelio Nakamura). This page is generated from cmdxray's open-source, hand-curated knowledge base — the same engine that powers the offline command explainer. Corrections welcome as issues or PRs.