cmdxray / commands / hostname

What does hostname do?

show or set the system's host name.

▸ Explain your own hostname command →

hostname examples, explained

$ hostname

  • hostnameshow or set the system's host name

$ hostname -I

  • hostnameshow or set the system's host name
  • -Iprint all network addresses of the host (space-separated)

$ hostname -f

  • hostnameshow or set the system's host name
  • -fprint the fully-qualified domain name (FQDN)

hostname flags & options

-Iprint all network addresses of the host (space-separated)
-iprint the host's IP address(es)
-fprint the fully-qualified domain name (FQDN)
-sprint the short host name (everything up to the first dot)
-dprint the DNS domain name
-aprint the host's alias names

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.