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 hostname for mounted
33       (but not booted) system images.
34

COMMANDS

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

OPTIONS

98       The following options are understood:
99
100       --no-ask-password
101           Do not query the user for authentication for privileged operations.
102
103       --static, --transient, --pretty
104           If status is invoked (or no explicit command is given) and one of
105           these switches is specified, hostnamectl will print out just this
106           selected hostname.
107
108           If used with set-hostname, only the selected hostname(s) will be
109           updated. When more than one of these switches are specified, all
110           the specified hostnames will be updated.
111
112       -H, --host=
113           Execute the operation remotely. Specify a hostname, or a username
114           and hostname separated by "@", to connect to. The hostname may
115           optionally be suffixed by a port ssh is listening on, separated by
116           ":", and then a container name, separated by "/", which connects
117           directly to a specific container on the specified host. This will
118           use SSH to talk to the remote machine manager instance. Container
119           names may be enumerated with machinectl -H HOST. Put IPv6 addresses
120           in brackets.
121
122       -M, --machine=
123           Execute operation on a local container. Specify a container name to
124           connect to.
125
126       -h, --help
127           Print a short help text and exit.
128
129       --version
130           Print a short version string and exit.
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 246                                                     HOSTNAMECTL(1)
Impressum