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