]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/hostnamectl.xml
man: xinclude --host/--machine
[thirdparty/systemd.git] / man / hostnamectl.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5 <!--
6 This file is part of systemd.
7
8 Copyright 2012 Lennart Poettering
9
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 -->
23
24 <refentry id="hostnamectl" conditional='ENABLE_HOSTNAMED'
25 xmlns:xi="http://www.w3.org/2001/XInclude">
26
27 <refentryinfo>
28 <title>hostnamectl</title>
29 <productname>systemd</productname>
30
31 <authorgroup>
32 <author>
33 <contrib>Developer</contrib>
34 <firstname>Lennart</firstname>
35 <surname>Poettering</surname>
36 <email>lennart@poettering.net</email>
37 </author>
38 </authorgroup>
39 </refentryinfo>
40
41 <refmeta>
42 <refentrytitle>hostnamectl</refentrytitle>
43 <manvolnum>1</manvolnum>
44 </refmeta>
45
46 <refnamediv>
47 <refname>hostnamectl</refname>
48 <refpurpose>Control the system hostname</refpurpose>
49 </refnamediv>
50
51 <refsynopsisdiv>
52 <cmdsynopsis>
53 <command>hostnamectl</command>
54 <arg choice="opt" rep="repeat">OPTIONS</arg>
55 <arg choice="req">COMMAND</arg>
56 </cmdsynopsis>
57 </refsynopsisdiv>
58
59 <refsect1>
60 <title>Description</title>
61
62 <para><command>hostnamectl</command> may be used to
63 query and change the system hostname and related
64 settings.</para>
65
66 <para>This tool distinguishes three different
67 hostnames: the high-level "pretty" hostname which
68 might include all kinds of special characters
69 (e.g. "Lennart's Laptop"), the static hostname which
70 is used to initialize the kernel hostname at boot
71 (e.g. "lennarts-laptop"), and the transient hostname
72 which might be assigned temporarily due to network
73 configuration and might revert back to the static
74 hostname if network connectivity is lost and is only
75 temporarily written to the kernel hostname
76 (e.g. "dhcp-47-11").</para>
77
78 <para>Note that the pretty hostname has little
79 restrictions on the characters used, while the static
80 and transient hostnames are limited to the usually
81 accepted characters of Internet domain names.</para>
82
83 <para>The static hostname is stored in
84 <filename>/etc/hostname</filename>, see
85 <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>5</manvolnum></citerefentry>
86 for more information. The pretty hostname, chassis
87 type, and icon name are stored in
88 <filename>/etc/machine-info</filename>, see
89 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
90 </refsect1>
91
92 <refsect1>
93 <title>Options</title>
94
95 <para>The following options are understood:</para>
96
97 <variablelist>
98 <varlistentry>
99 <term><option>--no-ask-password</option></term>
100
101 <listitem><para>Do not query the user
102 for authentication for privileged
103 operations.</para></listitem>
104 </varlistentry>
105
106 <varlistentry>
107 <term><option>-P</option></term>
108 <term><option>--privileged</option></term>
109
110 <listitem><para>Acquire privileges via PolicyKit
111 before executing the operation.</para></listitem>
112 </varlistentry>
113
114 <varlistentry>
115 <term><option>--static</option></term>
116 <term><option>--transient</option></term>
117 <term><option>--pretty</option></term>
118
119 <listitem><para>If
120 <command>status</command> is used (or
121 no explicit command is given) and one
122 of those fields is given,
123 <command>hostnamectl</command> will
124 print out just this selected
125 hostname.</para>
126
127 <para>If used with
128 <command>set-hostname</command>, only
129 the selected hostname(s) will be
130 updated. When more than one of those
131 options is used, all the specified
132 hostnames will be updated.
133 </para></listitem>
134 </varlistentry>
135
136 <xi:include href="user-system-options.xml" xpointer="host" />
137
138 <xi:include href="standard-options.xml" xpointer="help" />
139 <xi:include href="standard-options.xml" xpointer="version" />
140 </variablelist>
141
142 <para>The following commands are understood:</para>
143
144 <variablelist>
145 <varlistentry>
146 <term><command>status</command></term>
147
148 <listitem><para>Show current system
149 hostname and related
150 information.</para></listitem>
151 </varlistentry>
152
153 <varlistentry>
154 <term><command>set-hostname [NAME]</command></term>
155
156 <listitem><para>Set the system
157 hostname. By default, this will alter
158 the pretty, the static, and the
159 transient hostname alike; however, if
160 one or more of
161 <option>--static</option>,
162 <option>--transient</option>,
163 <option>--pretty</option> are used,
164 only the selected hostnames are
165 changed. If the pretty hostname is
166 being set, and static or transient are
167 being set as well, the specified
168 hostname will be simplified in regards
169 to the character set used before the
170 latter are updated. This is done by
171 replacing spaces with
172 <literal>-</literal> and removing
173 special characters. This ensures that
174 the pretty and the static hostname are
175 always closely related while still
176 following the validity rules of the
177 specific name. This simplification of
178 the hostname string is not done if
179 only the transient and/or static host
180 names are set, and the pretty host
181 name is left untouched. Pass the empty
182 string <literal></literal> as the
183 hostname to reset the selected
184 hostnames to their default (usually
185 <literal>localhost</literal>).</para></listitem>
186 </varlistentry>
187
188 <varlistentry>
189 <term><command>set-icon-name [NAME]</command></term>
190
191 <listitem><para>Set the system icon
192 name. The icon name is used by some
193 graphical applications to visualize
194 this host. The icon name should follow
195 the <ulink
196 url="http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html">Icon
197 Naming Specification</ulink>. Pass an
198 empty string to this operation to
199 reset the icon name to the default
200 value, which is determined from chassis
201 type (see below) and possibly other
202 parameters.</para></listitem>
203 </varlistentry>
204
205 <varlistentry>
206 <term><command>set-chassis [TYPE]</command></term>
207
208 <listitem><para>Set the chassis
209 type. The chassis type is used by some
210 graphical applications to visualize
211 the host or alter user
212 interaction. Currently, the following
213 chassis types are defined:
214 <literal>desktop</literal>,
215 <literal>laptop</literal>,
216 <literal>server</literal>,
217 <literal>tablet</literal>,
218 <literal>handset</literal>, as well as
219 the special chassis types
220 <literal>vm</literal> and
221 <literal>container</literal> for
222 virtualized systems that lack an
223 immediate physical chassis. Pass an
224 empty string to this operation to
225 reset the chassis type to the default
226 value which is determined from the
227 firmware and possibly other
228 parameters.</para></listitem>
229 </varlistentry>
230
231 </variablelist>
232 </refsect1>
233
234 <refsect1>
235 <title>Exit status</title>
236
237 <para>On success, 0 is returned, a non-zero failure
238 code otherwise.</para>
239 </refsect1>
240
241 <refsect1>
242 <title>See Also</title>
243 <para>
244 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
245 <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
246 <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
247 <citerefentry><refentrytitle>machine-info</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
248 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
249 <citerefentry><refentrytitle>systemd-hostnamed.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
250 </para>
251 </refsect1>
252
253 </refentry>