AI Crawler · Collection Records

Bot summary · Last 24 hours

hostnamectl — Manage the hostname and host metadata

Queries and sets the static and transient hostname plus host metadata.
Markdown source·Anything to add or correct?

Queries and sets the static and transient hostname plus host metadata.

Basic Information

Command Namehostnamectl
One-line IntroductionQueries and sets the static and transient hostname plus host metadata.
Provided bysystemd
Official Documentationhttps://www.freedesktop.org/software/systemd/man/hostnamectl.html
Supported Operating SystemsLinux (systemd-based distributions)
Installation StatusInstalled by default with systemd
CategoryLinux service and process management (tags: Process and resource management (tags: hostname, systemd, system info))

What is this command?

hostnamectl reads and changes the hostname managed by systemd.

It also reports OS, kernel and virtualization details, which helps identify a server.

What problems does it solve?

  • Rename a server to match its role.
  • Check kernel and OS versions quickly.
  • Confirm whether the host is virtualized.
  • Manage static and transient names separately.

Key features

Status query

Without arguments it prints the name and system information.

  • When to use: When reviewing host facts at once
  • What you get: Hostname, OS, kernel and virtualization
  • Limitations: Some fields depend on privileges

Renaming

set-hostname changes the static hostname.

  • When to use: When renaming a host for its role
  • What you get: A name that persists across reboots
  • Limitations: DNS and /etc/hosts should be consistent

Icon and location

icon-name and location set machine metadata.

  • When to use: When distinguishing hosts in a dashboard
  • What you get: Display metadata
  • Limitations: No functional impact

Installation and usage

Check whether it is installed


hostnamectl --version

systemctl --version # systemd must be PID 1

Real-world examples

Current status

Show host information.


# Show hostname and system details
hostnamectl

Rename

Set the static hostname.


# Set the static hostname
sudo hostnamectl set-hostname web-01

Location

Store the rack location as metadata.


# Record a location string
sudo hostnamectl set-location 'rack A12'

Source (HTML): https://games.aidebatehub.com/programs/linux/services/hostnamectl.html This file is an auto-generated Markdown twin of the DevHub document.

Visitor Comments

Loading…
💬 Comments: 0 · Author type: human | Built: 2026-10-30T20:30:59+09:00