1HOSTNAMECTL(1) hostnamectl HOSTNAMECTL(1)
2
3
4
6 hostnamectl - Control the system hostname
7
9 hostnamectl [OPTIONS...] {COMMAND}
10
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
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 container name, separated by ":", which
54 connects directly to a specific container on the specified host.
55 This will use SSH to talk to the remote machine manager instance.
56 Container names may be enumerated with machinectl -H HOST.
57
58 -M, --machine=
59 Execute operation on a local container. Specify a container name to
60 connect to.
61
62 -h, --help
63 Print a short help text and exit.
64
65 --version
66 Print a short version string and exit.
67
69 The following commands are understood:
70
71 status
72 Show current system hostname and related information. If no command
73 is specified, this is the implied default.
74
75 set-hostname NAME
76 Set the system hostname to NAME. By default, this will alter the
77 pretty, the static, and the transient hostname alike; however, if
78 one or more of --static, --transient, --pretty are used, only the
79 selected hostnames are changed. If the pretty hostname is being
80 set, and static or transient are being set as well, the specified
81 hostname will be simplified in regards to the character set used
82 before the latter are updated. This is done by removing special
83 characters and spaces. This ensures that the pretty and the static
84 hostname are always closely related while still following the
85 validity rules of the specific name. This simplification of the
86 hostname string is not done if only the transient and/or static
87 host names are set, and the pretty host name is left untouched.
88
89 Pass the empty string "" as the hostname to reset the selected
90 hostnames to their default (usually "localhost").
91
92 set-icon-name NAME
93 Set the system icon name to NAME. The icon name is used by some
94 graphical applications to visualize this host. The icon name should
95 follow the Icon Naming Specification[1].
96
97 Pass an empty string to reset the icon name to the default value,
98 which is determined from chassis type (see below) and possibly
99 other parameters.
100
101 set-chassis TYPE
102 Set the chassis type to TYPE. The chassis type is used by some
103 graphical applications to visualize the host or alter user
104 interaction. Currently, the following chassis types are defined:
105 "desktop", "laptop", "convertible", "server", "tablet", "handset",
106 "watch", "embedded", as well as the special chassis types "vm" and
107 "container" for virtualized systems that lack an immediate physical
108 chassis.
109
110 Pass an empty string to reset the chassis type to the default value
111 which is determined from the firmware and possibly other
112 parameters.
113
114 set-deployment ENVIRONMENT
115 Set the deployment environment description. ENVIRONMENT must be a
116 single word without any control characters. One of the following is
117 suggested: "development", "integration", "staging", "production".
118
119 Pass an empty string to reset to the default empty value.
120
121 set-location LOCATION
122 Set the location string for the system, if it is known. LOCATION
123 should be a human-friendly, free-form string describing the
124 physical location of the system, if it is known and applicable.
125 This may be as generic as "Berlin, Germany" or as specific as "Left
126 Rack, 2nd Shelf".
127
128 Pass an empty string to reset to the default empty value.
129
131 On success, 0 is returned, a non-zero failure code otherwise.
132
134 systemd(1), hostname(1), hostname(5), machine-info(5), systemctl(1),
135 systemd-hostnamed.service(8), systemd-firstboot(1)
136
138 1. Icon Naming Specification
139 http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
140
141
142
143systemd 239 HOSTNAMECTL(1)