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