]>
Commit | Line | Data |
---|---|---|
dbc4fbae | 1 | <?xml version='1.0'?> <!--*-nxml-*--> |
3a54a157 | 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
12b42c76 | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
0307f791 | 4 | <!-- SPDX-License-Identifier: LGPL-2.1+ --> |
dbc4fbae | 5 | |
dfdebb1b | 6 | <refentry id="hostnamectl" conditional='ENABLE_HOSTNAMED' |
798d3a52 ZJS |
7 | xmlns:xi="http://www.w3.org/2001/XInclude"> |
8 | ||
9 | <refentryinfo> | |
10 | <title>hostnamectl</title> | |
11 | <productname>systemd</productname> | |
798d3a52 ZJS |
12 | </refentryinfo> |
13 | ||
14 | <refmeta> | |
15 | <refentrytitle>hostnamectl</refentrytitle> | |
16 | <manvolnum>1</manvolnum> | |
17 | </refmeta> | |
18 | ||
19 | <refnamediv> | |
20 | <refname>hostnamectl</refname> | |
21 | <refpurpose>Control the system hostname</refpurpose> | |
22 | </refnamediv> | |
23 | ||
24 | <refsynopsisdiv> | |
25 | <cmdsynopsis> | |
26 | <command>hostnamectl</command> | |
27 | <arg choice="opt" rep="repeat">OPTIONS</arg> | |
28 | <arg choice="req">COMMAND</arg> | |
29 | </cmdsynopsis> | |
30 | </refsynopsisdiv> | |
31 | ||
32 | <refsect1> | |
33 | <title>Description</title> | |
34 | ||
35 | <para><command>hostnamectl</command> may be used to query and | |
36 | change the system hostname and related settings.</para> | |
37 | ||
38 | <para>This tool distinguishes three different hostnames: the | |
39 | high-level "pretty" hostname which might include all kinds of | |
40 | special characters (e.g. "Lennart's Laptop"), the static hostname | |
41 | which is used to initialize the kernel hostname at boot (e.g. | |
89a16758 ZJS |
42 | "lennarts-laptop"), and the transient hostname which is a fallback |
43 | value received from network configuration. If a static hostname is | |
44 | set, and is valid (something other than localhost), then the | |
45 | transient hostname is not used.</para> | |
798d3a52 | 46 | |
7c9f396b LP |
47 | <para>Note that the pretty hostname has little restrictions on the characters and length used, while the static and |
48 | transient hostnames are limited to the usually accepted characters of Internet domain names, and 64 characters at | |
49 | maximum (the latter being a Linux limitation).</para> | |
798d3a52 ZJS |
50 | |
51 | <para>The static hostname is stored in | |
52 | <filename>/etc/hostname</filename>, see | |
53 | <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
54 | for more information. The pretty hostname, chassis type, and icon | |
55 | name are stored in <filename>/etc/machine-info</filename>, see | |
56 | <citerefentry><refentrytitle>machine-info</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para> | |
57 | ||
58 | <para>Use | |
59 | <citerefentry><refentrytitle>systemd-firstboot</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
38b38500 | 60 | to initialize the system hostname for mounted (but not booted) |
798d3a52 ZJS |
61 | system images.</para> |
62 | </refsect1> | |
63 | ||
a456324f YW |
64 | <refsect1> |
65 | <title>Commands</title> | |
798d3a52 ZJS |
66 | |
67 | <para>The following commands are understood:</para> | |
68 | ||
69 | <variablelist> | |
70 | <varlistentry> | |
71 | <term><command>status</command></term> | |
72 | ||
a456324f YW |
73 | <listitem><para>Show current system hostname and related information. If no command is specified, |
74 | this is the implied default.</para></listitem> | |
798d3a52 ZJS |
75 | </varlistentry> |
76 | ||
77 | <varlistentry> | |
78 | <term><command>set-hostname <replaceable>NAME</replaceable></command></term> | |
79 | ||
0cce63da LP |
80 | <listitem><para>Set the system hostname to <replaceable>NAME</replaceable>. By default, this will alter the |
81 | pretty, the static, and the transient hostname alike; however, if one or more of <option>--static</option>, | |
82 | <option>--transient</option>, <option>--pretty</option> are used, only the selected hostnames are changed. If | |
83 | the pretty hostname is being set, and static or transient are being set as well, the specified hostname will be | |
84 | simplified in regards to the character set used before the latter are updated. This is done by removing special | |
85 | characters and spaces. This ensures that the pretty and the static hostname are always closely related while | |
86 | still following the validity rules of the specific name. This simplification of the hostname string is not done | |
38b38500 | 87 | if only the transient and/or static hostnames are set, and the pretty hostname is left untouched.</para> |
798d3a52 ZJS |
88 | |
89 | <para>Pass the empty string <literal></literal> as the | |
90 | hostname to reset the selected hostnames to their default | |
91 | (usually <literal>localhost</literal>).</para></listitem> | |
92 | </varlistentry> | |
93 | ||
94 | <varlistentry> | |
95 | <term><command>set-icon-name <replaceable>NAME</replaceable></command></term> | |
96 | ||
97 | <listitem><para>Set the system icon name to | |
98 | <replaceable>NAME</replaceable>. The icon name is used by some | |
99 | graphical applications to visualize this host. The icon name | |
100 | should follow the <ulink | |
101 | url="http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html">Icon | |
102 | Naming Specification</ulink>.</para> | |
103 | ||
104 | <para>Pass an empty string to reset the icon name to the | |
105 | default value, which is determined from chassis type (see | |
106 | below) and possibly other parameters.</para></listitem> | |
107 | </varlistentry> | |
108 | ||
109 | <varlistentry> | |
110 | <term><command>set-chassis <replaceable>TYPE</replaceable></command></term> | |
111 | ||
112 | <listitem><para>Set the chassis type to | |
113 | <replaceable>TYPE</replaceable>. The chassis type is used by | |
114 | some graphical applications to visualize the host or alter | |
115 | user interaction. Currently, the following chassis types are | |
116 | defined: | |
117 | <literal>desktop</literal>, | |
118 | <literal>laptop</literal>, | |
34b52450 | 119 | <literal>convertible</literal>, |
798d3a52 ZJS |
120 | <literal>server</literal>, |
121 | <literal>tablet</literal>, | |
122 | <literal>handset</literal>, | |
123 | <literal>watch</literal>, | |
124 | <literal>embedded</literal>, | |
125 | as well as the special chassis types | |
126 | <literal>vm</literal> and | |
127 | <literal>container</literal> for virtualized systems that lack | |
128 | an immediate physical chassis.</para> | |
129 | ||
130 | <para>Pass an empty string to reset the chassis type to the | |
131 | default value which is determined from the firmware and | |
132 | possibly other parameters.</para> | |
133 | </listitem> | |
134 | </varlistentry> | |
135 | ||
136 | <varlistentry> | |
137 | <term><command>set-deployment <replaceable>ENVIRONMENT</replaceable></command></term> | |
138 | ||
139 | <listitem><para>Set the deployment environment description. | |
140 | <replaceable>ENVIRONMENT</replaceable> must be a single word | |
141 | without any control characters. One of the following is | |
142 | suggested: | |
143 | <literal>development</literal>, | |
144 | <literal>integration</literal>, | |
145 | <literal>staging</literal>, | |
146 | <literal>production</literal>. | |
147 | </para> | |
148 | ||
149 | <para>Pass an empty string to reset to the default empty | |
150 | value.</para> | |
151 | </listitem> | |
152 | </varlistentry> | |
153 | ||
154 | <varlistentry> | |
155 | <term><command>set-location <replaceable>LOCATION</replaceable></command></term> | |
156 | ||
157 | <listitem><para>Set the location string for the system, if it | |
158 | is known. <replaceable>LOCATION</replaceable> should be a | |
159 | human-friendly, free-form string describing the physical | |
160 | location of the system, if it is known and applicable. This | |
161 | may be as generic as <literal>Berlin, Germany</literal> or as | |
162 | specific as <literal>Left Rack, 2nd Shelf</literal>.</para> | |
163 | ||
164 | <para>Pass an empty string to reset to the default empty | |
165 | value.</para> | |
166 | </listitem> | |
167 | </varlistentry> | |
168 | </variablelist> | |
169 | </refsect1> | |
170 | ||
e1fac8a6 ZJS |
171 | <refsect1> |
172 | <title>Options</title> | |
173 | ||
174 | <para>The following options are understood:</para> | |
175 | ||
176 | <variablelist> | |
177 | <varlistentry> | |
178 | <term><option>--no-ask-password</option></term> | |
179 | ||
180 | <listitem><para>Do not query the user for authentication for | |
181 | privileged operations.</para></listitem> | |
182 | </varlistentry> | |
183 | ||
184 | <varlistentry> | |
185 | <term><option>--static</option></term> | |
186 | <term><option>--transient</option></term> | |
187 | <term><option>--pretty</option></term> | |
188 | ||
189 | <listitem><para>If <command>status</command> is invoked (or no explicit command is given) and one of these | |
190 | switches is specified, <command>hostnamectl</command> will print out just this selected hostname.</para> | |
191 | ||
192 | <para>If used with <command>set-hostname</command>, only the selected hostname(s) will be updated. When more | |
193 | than one of these switches are specified, all the specified hostnames will be updated. </para></listitem> | |
194 | </varlistentry> | |
195 | ||
196 | <xi:include href="user-system-options.xml" xpointer="host" /> | |
197 | <xi:include href="user-system-options.xml" xpointer="machine" /> | |
198 | ||
199 | <xi:include href="standard-options.xml" xpointer="help" /> | |
200 | <xi:include href="standard-options.xml" xpointer="version" /> | |
201 | </variablelist> | |
202 | </refsect1> | |
203 | ||
798d3a52 ZJS |
204 | <refsect1> |
205 | <title>Exit status</title> | |
206 | ||
207 | <para>On success, 0 is returned, a non-zero failure code | |
208 | otherwise.</para> | |
209 | </refsect1> | |
210 | ||
211 | <refsect1> | |
212 | <title>See Also</title> | |
213 | <para> | |
214 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
215 | <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
216 | <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
217 | <citerefentry><refentrytitle>machine-info</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
218 | <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
219 | <citerefentry><refentrytitle>systemd-hostnamed.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, | |
220 | <citerefentry><refentrytitle>systemd-firstboot</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
221 | </para> | |
222 | </refsect1> | |
dbc4fbae LP |
223 | |
224 | </refentry> |