1HOSTNAMECTL(1)                    hostnamectl                   HOSTNAMECTL(1)
2
3
4

NAME

6       hostnamectl - Control the system hostname
7

SYNOPSIS

9       hostnamectl [OPTIONS...] {COMMAND}
10

DESCRIPTION

12       hostnamectl may be used to query and change the system hostname and
13       related settings.
14
15       This tool distinguishes three different hostnames: the high-level
16       "pretty" hostname which might include all kinds of special characters
17       (e.g. "Lennart's Laptop"), the static hostname which is used to
18       initialize the kernel hostname at boot (e.g. "lennarts-laptop"), and
19       the transient hostname which is a default received from network
20       configuration. If a static hostname is set, and is valid (something
21       other than localhost), then the transient hostname is not used.
22
23       Note that the pretty hostname has little restrictions on the characters
24       used, while the static and transient hostnames are limited to the
25       usually accepted characters of Internet domain names.
26
27       The static hostname is stored in /etc/hostname, see hostname(5) for
28       more information. The pretty hostname, chassis type, and icon name are
29       stored in /etc/machine-info, see machine-info(5).
30
31       Use systemd-firstboot(1) to initialize the system host name for mounted
32       (but not booted) system images.
33

OPTIONS

35       The following options are understood:
36
37       --no-ask-password
38           Do not query the user for authentication for privileged operations.
39
40       --static, --transient, --pretty
41           If status is used (or no explicit command is given) and one of
42           those fields is given, hostnamectl will print out just this
43           selected hostname.
44
45           If used with set-hostname, only the selected hostname(s) will be
46           updated. When more than one of those options is used, all the
47           specified hostnames will be updated.
48
49       -H, --host=
50           Execute the operation remotely. Specify a hostname, or a username
51           and hostname separated by "@", to connect to. The hostname may
52           optionally be suffixed by a container name, separated by ":", which
53           connects directly to a specific container on the specified host.
54           This will use SSH to talk to the remote machine manager instance.
55           Container names may be enumerated with machinectl -H HOST.
56
57       -M, --machine=
58           Execute operation on a local container. Specify a container name to
59           connect to.
60
61       -h, --help
62           Print a short help text and exit.
63
64       --version
65           Print a short version string and exit.
66
67       The following commands are understood:
68
69       status
70           Show current system hostname and related information.
71
72       set-hostname NAME
73           Set the system hostname to NAME. By default, this will alter the
74           pretty, the static, and the transient hostname alike; however, if
75           one or more of --static, --transient, --pretty are used, only the
76           selected hostnames are changed. If the pretty hostname is being
77           set, and static or transient are being set as well, the specified
78           hostname will be simplified in regards to the character set used
79           before the latter are updated. This is done by replacing spaces
80           with "-" and removing special characters. This ensures that the
81           pretty and the static hostname are always closely related while
82           still following the validity rules of the specific name. This
83           simplification of the hostname string is not done if only the
84           transient and/or static host names are set, and the pretty host
85           name is left untouched.
86
87           Pass the empty string "" as the hostname to reset the selected
88           hostnames to their default (usually "localhost").
89
90       set-icon-name NAME
91           Set the system icon name to NAME. The icon name is used by some
92           graphical applications to visualize this host. The icon name should
93           follow the Icon Naming Specification[1].
94
95           Pass an empty string to reset the icon name to the default value,
96           which is determined from chassis type (see below) and possibly
97           other parameters.
98
99       set-chassis TYPE
100           Set the chassis type to TYPE. The chassis type is used by some
101           graphical applications to visualize the host or alter user
102           interaction. Currently, the following chassis types are defined:
103           "desktop", "laptop", "server", "tablet", "handset", "watch",
104           "embedded", as well as the special chassis types "vm" and
105           "container" for virtualized systems that lack an immediate physical
106           chassis.
107
108           Pass an empty string to reset the chassis type to the default value
109           which is determined from the firmware and possibly other
110           parameters.
111
112       set-deployment ENVIRONMENT
113           Set the deployment environment description.  ENVIRONMENT must be a
114           single word without any control characters. One of the following is
115           suggested: "development", "integration", "staging", "production".
116
117           Pass an empty string to reset to the default empty value.
118
119       set-location LOCATION
120           Set the location string for the system, if it is known.  LOCATION
121           should be a human-friendly, free-form string describing the
122           physical location of the system, if it is known and applicable.
123           This may be as generic as "Berlin, Germany" or as specific as "Left
124           Rack, 2nd Shelf".
125
126           Pass an empty string to reset to the default empty value.
127

EXIT STATUS

129       On success, 0 is returned, a non-zero failure code otherwise.
130

SEE ALSO

132       systemd(1), hostname(1), hostname(5), machine-info(5), systemctl(1),
133       systemd-hostnamed.service(8), systemd-firstboot(1)
134

NOTES

136        1. Icon Naming Specification
137           http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
138
139
140
141systemd 219                                                     HOSTNAMECTL(1)
Impressum