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