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 fallback value 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       and length used, while the static and transient hostnames are limited
25       to the usually accepted characters of Internet domain names, and 64
26       characters at maximum (the latter being a Linux limitation).
27
28       The static hostname is stored in /etc/hostname, see hostname(5) for
29       more information. The pretty hostname, chassis type, and icon name are
30       stored in /etc/machine-info, see machine-info(5).
31
32       Use systemd-firstboot(1) to initialize the system host name for mounted
33       (but not booted) system images.
34

OPTIONS

36       The following options are understood:
37
38       --no-ask-password
39           Do not query the user for authentication for privileged operations.
40
41       --static, --transient, --pretty
42           If status is invoked (or no explicit command is given) and one of
43           these switches is specified, hostnamectl will print out just this
44           selected hostname.
45
46           If used with set-hostname, only the selected hostname(s) will be
47           updated. When more than one of these switches are specified, all
48           the specified hostnames will be updated.
49
50       -H, --host=
51           Execute the operation remotely. Specify a hostname, or a username
52           and hostname separated by "@", to connect to. The hostname may
53           optionally be suffixed by a port ssh is listening on, separated by
54           ":", and then a container name, separated by "/", which connects
55           directly to a specific container on the specified host. This will
56           use SSH to talk to the remote machine manager instance. Container
57           names may be enumerated with machinectl -H HOST. Put IPv6 addresses
58           in brackets.
59
60       -M, --machine=
61           Execute operation on a local container. Specify a container name to
62           connect to.
63
64       -h, --help
65           Print a short help text and exit.
66
67       --version
68           Print a short version string and exit.
69

COMMANDS

71       The following commands are understood:
72
73       status
74           Show current system hostname and related information. If no command
75           is specified, this is the implied default.
76
77       set-hostname NAME
78           Set the system hostname to NAME. By default, this will alter the
79           pretty, the static, and the transient hostname alike; however, if
80           one or more of --static, --transient, --pretty are used, only the
81           selected hostnames are changed. If the pretty hostname is being
82           set, and static or transient are being set as well, the specified
83           hostname will be simplified in regards to the character set used
84           before the latter are updated. This is done by removing special
85           characters and spaces. This ensures that the pretty and the static
86           hostname are always closely related while still following the
87           validity rules of the specific name. This simplification of the
88           hostname string is not done if only the transient and/or static
89           host names are set, and the pretty host name is left untouched.
90
91           Pass the empty string "" as the hostname to reset the selected
92           hostnames to their default (usually "localhost").
93
94       set-icon-name NAME
95           Set the system icon name to NAME. The icon name is used by some
96           graphical applications to visualize this host. The icon name should
97           follow the Icon Naming Specification[1].
98
99           Pass an empty string to reset the icon name to the default value,
100           which is determined from chassis type (see below) and possibly
101           other parameters.
102
103       set-chassis TYPE
104           Set the chassis type to TYPE. The chassis type is used by some
105           graphical applications to visualize the host or alter user
106           interaction. Currently, the following chassis types are defined:
107           "desktop", "laptop", "convertible", "server", "tablet", "handset",
108           "watch", "embedded", as well as the special chassis types "vm" and
109           "container" for virtualized systems that lack an immediate physical
110           chassis.
111
112           Pass an empty string to reset the chassis type to the default value
113           which is determined from the firmware and possibly other
114           parameters.
115
116       set-deployment ENVIRONMENT
117           Set the deployment environment description.  ENVIRONMENT must be a
118           single word without any control characters. One of the following is
119           suggested: "development", "integration", "staging", "production".
120
121           Pass an empty string to reset to the default empty value.
122
123       set-location LOCATION
124           Set the location string for the system, if it is known.  LOCATION
125           should be a human-friendly, free-form string describing the
126           physical location of the system, if it is known and applicable.
127           This may be as generic as "Berlin, Germany" or as specific as "Left
128           Rack, 2nd Shelf".
129
130           Pass an empty string to reset to the default empty value.
131

EXIT STATUS

133       On success, 0 is returned, a non-zero failure code otherwise.
134

SEE ALSO

136       systemd(1), hostname(1), hostname(5), machine-info(5), systemctl(1),
137       systemd-hostnamed.service(8), systemd-firstboot(1)
138

NOTES

140        1. Icon Naming Specification
141           http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
142
143
144
145systemd 243                                                     HOSTNAMECTL(1)
Impressum