Services and System Control

hostnamectl

Views and changes system hostname metadata.

hostnamectl is a systemd tool for static hostnames, pretty hostnames, chassis type, and related machine identity fields.

Syntax
hostnamectl [command]

Arguments explained

  • Options adjust output or behavior.
  • Arguments name the files, services, hosts, or values the command should work with.

Common examples

Show hostname data
hostnamectl

Displays hostname and operating system metadata.

Set hostname
sudo hostnamectl set-hostname server1

Sets the system's static hostname.

hostnamectl Command
FieldDetails
Commandhostnamectl
CategoryServices and System Control
Primary useViews and changes system hostname metadata.
Syntaxhostnamectl [command]