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       systemd-hostnamed.service(8) and this tool distinguish three different
16       hostnames: the high-level "pretty" hostname which might include all
17       kinds of special characters (e.g. "Lennart's Laptop"), the "static"
18       hostname which is the user-configured hostname (e.g.
19       "lennarts-laptop"), and the transient hostname which is a fallback
20       value received from network configuration (e.g. "node12345678"). If a
21       static hostname is set to a valid value, then the transient hostname is
22       not used.
23
24       Note that the pretty hostname has little restrictions on the characters
25       and length used, while the static and transient hostnames are limited
26       to the usually accepted characters of Internet domain names, and 64
27       characters at maximum (the latter being a Linux limitation).
28
29       Use systemd-firstboot(1) to initialize the system hostname for mounted
30       (but not booted) system images.
31

COMMANDS

33       The following commands are understood:
34
35       status
36           Show current system hostname and related information. If no command
37           is specified, this is the implied default.
38
39       set-hostname NAME
40           Set the system hostname to NAME. By default, this will alter the
41           pretty, the static, and the transient hostname alike; however, if
42           one or more of --static, --transient, --pretty are used, only the
43           selected hostnames are changed. If the pretty hostname is being
44           set, and static or transient are being set as well, the specified
45           hostname will be simplified in regards to the character set used
46           before the latter are updated. This is done by removing special
47           characters and spaces. This ensures that the pretty and the static
48           hostname are always closely related while still following the
49           validity rules of the specific name. This simplification of the
50           hostname string is not done if only the transient and/or static
51           hostnames are set, and the pretty hostname is left untouched.
52
53           The static and transient hostnames must each be either a single DNS
54           label (a string composed of 7-bit ASCII lower-case characters and
55           no spaces or dots, limited to the format allowed for DNS domain
56           name labels), or a sequence of such labels separated by single dots
57           that forms a valid DNS FQDN. The hostname must be at most 64
58           characters, which is a Linux limitation (DNS allows longer names).
59
60           Pass the empty string "" as the hostname to reset the selected
61           hostnames to their default (usually "fedora").
62
63       set-icon-name NAME
64           Set the system icon name to NAME. The icon name is used by some
65           graphical applications to visualize this host. The icon name should
66           follow the Icon Naming Specification[1].
67
68           Pass an empty string to reset the icon name to the default value,
69           which is determined from chassis type (see below) and possibly
70           other parameters.
71
72       set-chassis TYPE
73           Set the chassis type to TYPE. The chassis type is used by some
74           graphical applications to visualize the host or alter user
75           interaction. Currently, the following chassis types are defined:
76           "desktop", "laptop", "convertible", "server", "tablet", "handset",
77           "watch", "embedded", as well as the special chassis types "vm" and
78           "container" for virtualized systems that lack an immediate physical
79           chassis.
80
81           Pass an empty string to reset the chassis type to the default value
82           which is determined from the firmware and possibly other
83           parameters.
84
85       set-deployment ENVIRONMENT
86           Set the deployment environment description.  ENVIRONMENT must be a
87           single word without any control characters. One of the following is
88           suggested: "development", "integration", "staging", "production".
89
90           Pass an empty string to reset to the default empty value.
91
92       set-location LOCATION
93           Set the location string for the system, if it is known.  LOCATION
94           should be a human-friendly, free-form string describing the
95           physical location of the system, if it is known and applicable.
96           This may be as generic as "Berlin, Germany" or as specific as "Left
97           Rack, 2nd Shelf".
98
99           Pass an empty string to reset to the default empty value.
100

OPTIONS

102       The following options are understood:
103
104       --no-ask-password
105           Do not query the user for authentication for privileged operations.
106
107       --static, --transient, --pretty
108           If status is invoked (or no explicit command is given) and one of
109           these switches is specified, hostnamectl will print out just this
110           selected hostname.
111
112           If used with set-hostname, only the selected hostname(s) will be
113           updated. When more than one of these switches are specified, all
114           the specified hostnames will be updated.
115
116       -H, --host=
117           Execute the operation remotely. Specify a hostname, or a username
118           and hostname separated by "@", to connect to. The hostname may
119           optionally be suffixed by a port ssh is listening on, separated by
120           ":", and then a container name, separated by "/", which connects
121           directly to a specific container on the specified host. This will
122           use SSH to talk to the remote machine manager instance. Container
123           names may be enumerated with machinectl -H HOST. Put IPv6 addresses
124           in brackets.
125
126       -M, --machine=
127           Execute operation on a local container. Specify a container name to
128           connect to, optionally prefixed by a user name to connect as and a
129           separating "@" character. If the special string ".host" is used in
130           place of the container name, a connection to the local system is
131           made (which is useful to connect to a specific user's user bus:
132           "--user --machine=lennart@.host"). If the "@" syntax is not used,
133           the connection is made as root user. If the "@" syntax is used
134           either the left hand side or the right hand side may be omitted
135           (but not both) in which case the local user name and ".host" are
136           implied.
137
138       -h, --help
139           Print a short help text and exit.
140
141       --version
142           Print a short version string and exit.
143

EXIT STATUS

145       On success, 0 is returned, a non-zero failure code otherwise.
146

SEE ALSO

148       systemd(1), hostname(1), hostname(5), machine-info(5), systemctl(1),
149       systemd-hostnamed.service(8), systemd-firstboot(1)
150

NOTES

152        1. Icon Naming Specification
153           http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
154
155
156
157systemd 248                                                     HOSTNAMECTL(1)
Impressum