]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/hostnamectl.xml
travis: use UBSan checks from OSS-Fuzz
[thirdparty/systemd.git] / man / hostnamectl.xml
CommitLineData
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>
60 to initialize the system host name for mounted (but not booted)
61 system images.</para>
62 </refsect1>
63
64 <refsect1>
65 <title>Options</title>
66
67 <para>The following options are understood:</para>
68
69 <variablelist>
70 <varlistentry>
71 <term><option>--no-ask-password</option></term>
72
73 <listitem><para>Do not query the user for authentication for
74 privileged operations.</para></listitem>
75 </varlistentry>
76
77 <varlistentry>
78 <term><option>--static</option></term>
79 <term><option>--transient</option></term>
80 <term><option>--pretty</option></term>
81
986cf85d
LP
82 <listitem><para>If <command>status</command> is invoked (or no explicit command is given) and one of these
83 switches is specified, <command>hostnamectl</command> will print out just this selected hostname.</para>
84
85 <para>If used with <command>set-hostname</command>, only the selected hostname(s) will be updated. When more
86 than one of these switches are specified, all the specified hostnames will be updated. </para></listitem>
798d3a52
ZJS
87 </varlistentry>
88
89 <xi:include href="user-system-options.xml" xpointer="host" />
90 <xi:include href="user-system-options.xml" xpointer="machine" />
91
92 <xi:include href="standard-options.xml" xpointer="help" />
93 <xi:include href="standard-options.xml" xpointer="version" />
94 </variablelist>
a456324f
YW
95 </refsect1>
96
97 <refsect1>
98 <title>Commands</title>
798d3a52
ZJS
99
100 <para>The following commands are understood:</para>
101
102 <variablelist>
103 <varlistentry>
104 <term><command>status</command></term>
105
a456324f
YW
106 <listitem><para>Show current system hostname and related information. If no command is specified,
107 this is the implied default.</para></listitem>
798d3a52
ZJS
108 </varlistentry>
109
110 <varlistentry>
111 <term><command>set-hostname <replaceable>NAME</replaceable></command></term>
112
0cce63da
LP
113 <listitem><para>Set the system hostname to <replaceable>NAME</replaceable>. By default, this will alter the
114 pretty, the static, and the transient hostname alike; however, if one or more of <option>--static</option>,
115 <option>--transient</option>, <option>--pretty</option> are used, only the selected hostnames are changed. If
116 the pretty hostname is being set, and static or transient are being set as well, the specified hostname will be
117 simplified in regards to the character set used before the latter are updated. This is done by removing special
118 characters and spaces. This ensures that the pretty and the static hostname are always closely related while
119 still following the validity rules of the specific name. This simplification of the hostname string is not done
120 if only the transient and/or static host names are set, and the pretty host name is left untouched.</para>
798d3a52
ZJS
121
122 <para>Pass the empty string <literal></literal> as the
123 hostname to reset the selected hostnames to their default
124 (usually <literal>localhost</literal>).</para></listitem>
125 </varlistentry>
126
127 <varlistentry>
128 <term><command>set-icon-name <replaceable>NAME</replaceable></command></term>
129
130 <listitem><para>Set the system icon name to
131 <replaceable>NAME</replaceable>. The icon name is used by some
132 graphical applications to visualize this host. The icon name
133 should follow the <ulink
134 url="http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html">Icon
135 Naming Specification</ulink>.</para>
136
137 <para>Pass an empty string to reset the icon name to the
138 default value, which is determined from chassis type (see
139 below) and possibly other parameters.</para></listitem>
140 </varlistentry>
141
142 <varlistentry>
143 <term><command>set-chassis <replaceable>TYPE</replaceable></command></term>
144
145 <listitem><para>Set the chassis type to
146 <replaceable>TYPE</replaceable>. The chassis type is used by
147 some graphical applications to visualize the host or alter
148 user interaction. Currently, the following chassis types are
149 defined:
150 <literal>desktop</literal>,
151 <literal>laptop</literal>,
34b52450 152 <literal>convertible</literal>,
798d3a52
ZJS
153 <literal>server</literal>,
154 <literal>tablet</literal>,
155 <literal>handset</literal>,
156 <literal>watch</literal>,
157 <literal>embedded</literal>,
158 as well as the special chassis types
159 <literal>vm</literal> and
160 <literal>container</literal> for virtualized systems that lack
161 an immediate physical chassis.</para>
162
163 <para>Pass an empty string to reset the chassis type to the
164 default value which is determined from the firmware and
165 possibly other parameters.</para>
166 </listitem>
167 </varlistentry>
168
169 <varlistentry>
170 <term><command>set-deployment <replaceable>ENVIRONMENT</replaceable></command></term>
171
172 <listitem><para>Set the deployment environment description.
173 <replaceable>ENVIRONMENT</replaceable> must be a single word
174 without any control characters. One of the following is
175 suggested:
176 <literal>development</literal>,
177 <literal>integration</literal>,
178 <literal>staging</literal>,
179 <literal>production</literal>.
180 </para>
181
182 <para>Pass an empty string to reset to the default empty
183 value.</para>
184 </listitem>
185 </varlistentry>
186
187 <varlistentry>
188 <term><command>set-location <replaceable>LOCATION</replaceable></command></term>
189
190 <listitem><para>Set the location string for the system, if it
191 is known. <replaceable>LOCATION</replaceable> should be a
192 human-friendly, free-form string describing the physical
193 location of the system, if it is known and applicable. This
194 may be as generic as <literal>Berlin, Germany</literal> or as
195 specific as <literal>Left Rack, 2nd Shelf</literal>.</para>
196
197 <para>Pass an empty string to reset to the default empty
198 value.</para>
199 </listitem>
200 </varlistentry>
201 </variablelist>
202 </refsect1>
203
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>