table of contents
HOSTNAMECTL(1) | hostnamectl | HOSTNAMECTL(1) |
NAME¶
hostnamectl - Control the system hostname
SYNOPSIS¶
hostnamectl [OPTIONS...] {COMMAND}
DESCRIPTION¶
hostnamectl may be used to query and change the system hostname and related settings.
This tool distinguishes three different hostnames: the high-level "pretty" hostname which might include all kinds of special characters (e.g. "Lennart's Laptop"), the static hostname which is used to initialize the kernel hostname at boot (e.g. "lennarts-laptop"), and the transient hostname which is a default received from network configuration. If a static hostname is set, and is valid (something other than localhost), then the transient hostname is not used.
Note that the pretty hostname has little restrictions on the characters used, while the static and transient hostnames are limited to the usually accepted characters of Internet domain names.
The static hostname is stored in /etc/hostname, see hostname(5) for more information. The pretty hostname, chassis type, and icon name are stored in /etc/machine-info, see machine-info(5).
Use systemd-firstboot(1) to initialize the system host name for mounted (but not booted) system images.
OPTIONS¶
The following options are understood:
--no-ask-password
--static, --transient, --pretty
If used with set-hostname, only the selected hostname(s) will be updated. When more than one of those options is used, all the specified hostnames will be updated.
-H, --host=
-M, --machine=
-h, --help
--version
The following commands are understood:
status
set-hostname NAME
Pass the empty string "" as the hostname to reset the selected hostnames to their default (usually "localhost").
set-icon-name NAME
Pass an empty string to reset the icon name to the default value, which is determined from chassis type (see below) and possibly other parameters.
set-chassis TYPE
Pass an empty string to reset the chassis type to the default value which is determined from the firmware and possibly other parameters.
set-deployment ENVIRONMENT
Pass an empty string to reset to the default empty value.
set-location LOCATION
Pass an empty string to reset to the default empty value.
EXIT STATUS¶
On success, 0 is returned, a non-zero failure code otherwise.
SEE ALSO¶
systemd(1), hostname(1), hostname(5), machine-info(5), systemctl(1), systemd-hostnamed.service(8), systemd-firstboot(1)
NOTES¶
- 1.
- Icon Naming Specification
systemd 219 |