The hostnamectl command is used to query and set a system’s hostname and other related settings on Linux systems. hostnamectl is provided by systemd.
Syntax:
hostnamectl [OPTIONS] COMMAND
Commands:
status - show the hostname and other related info
% hostnamectl status
Static hostname: wildcat
Icon name: computer-laptop
Chassis: laptop
Machine ID: f6c85116c241be4634841e0a5fde3ff0
Boot ID: 2df128d55a3742efc32f5f25dc1c6d29
Operating System: Ubuntu 20.04.6 LTS
Kernel: Linux 5.15.0-122-generic
Architecture: x86-64
set-icon-name - sets the system icon to name. See http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
set-chassis - sets the chassis type: desktop, laptop, convertible, server, tablet, handset, watch, embedded, …
set-deployment - set the description of the deployment environment: development, integration, staging, production, …
set-location - set the physical location of the system: Las Vegas, Rack 19 unit 6, …
Related Files: /etc/hostname /etc/machine-info