chiark / gitweb /
man: remove note about shutdown being legacy
[elogind.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
26         <refentryinfo>
27                 <title>hostnamectl</title>
28                 <productname>systemd</productname>
29
30                 <authorgroup>
31                         <author>
32                                 <contrib>Developer</contrib>
33                                 <firstname>Lennart</firstname>
34                                 <surname>Poettering</surname>
35                                 <email>lennart@poettering.net</email>
36                         </author>
37                 </authorgroup>
38         </refentryinfo>
39
40         <refmeta>
41                 <refentrytitle>hostnamectl</refentrytitle>
42                 <manvolnum>1</manvolnum>
43         </refmeta>
44
45         <refnamediv>
46                 <refname>hostnamectl</refname>
47                 <refpurpose>Control the system hostname</refpurpose>
48         </refnamediv>
49
50         <refsynopsisdiv>
51                 <cmdsynopsis>
52                         <command>hostnamectl <arg choice="opt" rep="repeat">OPTIONS</arg> <arg choice="req">COMMAND</arg></command>
53                 </cmdsynopsis>
54         </refsynopsisdiv>
55
56         <refsect1>
57                 <title>Description</title>
58
59                 <para><command>hostnamectl</command> may be used to
60                 query and change the system hostname and related
61                 settings.</para>
62
63                 <para>This tool distinguishes three different
64                 hostnames: the high-level "pretty" hostname which
65                 might include all kinds of special characters
66                 (e.g. "Lennart's Laptop"), the static hostname which
67                 is used to initialize the kernel hostname at boot
68                 (e.g. "lennarts-laptop"), and the transient hostname
69                 which might be assigned temporarily due to network
70                 configuration and might revert back to the static
71                 hostname if network connectivity is lost and is only
72                 temporarily written to the kernel hostname
73                 (e.g. "dhcp-47-11").</para>
74
75                 <para>Note that the pretty hostname has little
76                 restrictions on the characters used, while the static
77                 and transient hostnames are limited to the usually
78                 accepted characters of Internet domain names.</para>
79
80                 <para>The static hostname is stored in
81                 <filename>/etc/hostname</filename>, see
82                 <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>5</manvolnum></citerefentry>
83                 for more information. The pretty hostname, chassis
84                 type and icon name are stored in
85                 <filename>/etc/machine-info</filename>, see
86                 <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
87         </refsect1>
88
89         <refsect1>
90                 <title>Options</title>
91
92                 <para>The following options are understood:</para>
93
94                 <variablelist>
95                         <varlistentry>
96                                 <term><option>-h</option></term>
97                                 <term><option>--help</option></term>
98
99                                 <listitem><para>Prints a short help
100                                 text and exits.</para></listitem>
101                         </varlistentry>
102
103                         <varlistentry>
104                                 <term><option>--version</option></term>
105
106                                 <listitem><para>Prints a short version
107                                 string and exits.</para></listitem>
108                         </varlistentry>
109
110                         <varlistentry>
111                                 <term><option>--no-ask-password</option></term>
112
113                                 <listitem><para>Do not query the user
114                                 for authentication for privileged
115                                 operations.</para></listitem>
116                         </varlistentry>
117
118                         <varlistentry>
119                                 <term><option>-P</option></term>
120                                 <term><option>--privileged</option></term>
121
122                                 <listitem><para>Acquire privileges via PolicyKit
123                                 before executing the operation.</para></listitem>
124                         </varlistentry>
125
126                         <varlistentry>
127                                 <term><option>-H</option></term>
128                                 <term><option>--host</option></term>
129
130                                 <listitem><para>Execute the operation
131                                 remotely. Specify a hostname, or
132                                 username and hostname separated by <literal>@</literal>,
133                                 to connect to. This will use SSH to
134                                 talk to a remote
135                                 system.</para></listitem>
136                         </varlistentry>
137
138                         <varlistentry>
139                                 <term><option>--static</option></term>
140                                 <term><option>--transient</option></term>
141                                 <term><option>--pretty</option></term>
142
143                                 <listitem><para>If
144                                 <command>set-hostname</command> is
145                                 invoked and one or more of these
146                                 options are passed, only the selected
147                                 hostname(s) is/are
148                                 updated.</para></listitem>
149                         </varlistentry>
150                 </variablelist>
151
152                 <para>The following commands are understood:</para>
153
154                 <variablelist>
155                         <varlistentry>
156                                 <term><command>status</command></term>
157
158                                 <listitem><para>Show current system
159                                 hostname and related
160                                 information.</para></listitem>
161                         </varlistentry>
162
163                         <varlistentry>
164                                 <term><command>set-hostname [NAME]</command></term>
165
166                                 <listitem><para>Set the system
167                                 hostname. By default, this will alter
168                                 the pretty, the static, and the
169                                 transient hostname alike; however, if
170                                 one or more of
171                                 <option>--static</option>,
172                                 <option>--transient</option>,
173                                 <option>--pretty</option> are used,
174                                 only the selected hostnames are
175                                 changed. If the pretty hostname is
176                                 being set, and static or transient are
177                                 being set as well, the specified
178                                 hostname will be simplified in regards
179                                 to the character set used before the
180                                 latter are updated. This is done by
181                                 replacing spaces with
182                                 <literal>-</literal> and removing
183                                 special characters. This ensures that
184                                 the pretty and the static hostname are
185                                 always closely related while still
186                                 following the validity rules of the
187                                 specific name. This simplification of
188                                 the hostname string is not done if
189                                 only the transient and/or static host
190                                 names are set, and the pretty host
191                                 name is left untouched. Pass the empty
192                                 string <literal></literal> as the
193                                 hostname to reset the selected
194                                 hostnames to their default (usually
195                                 <literal>localhost</literal>).</para></listitem>
196                         </varlistentry>
197
198                         <varlistentry>
199                                 <term><command>set-icon-name [NAME]</command></term>
200
201                                 <listitem><para>Set the system icon
202                                 name. The icon name is used by some
203                                 graphical applications to visualize
204                                 this host. The icon name should follow
205                                 the <ulink
206                                 url="http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html">Icon
207                                 Naming Specification</ulink>. Pass an
208                                 empty string to this operation to
209                                 reset the icon name to the default
210                                 value, which is determined from chassis
211                                 type (see below) and possibly other
212                                 parameters.</para></listitem>
213                         </varlistentry>
214
215                         <varlistentry>
216                                 <term><command>set-chassis [TYPE]</command></term>
217
218                                 <listitem><para>Set the chassis
219                                 type. The chassis type is used by some
220                                 graphical applications to visualize
221                                 the host or alter user
222                                 interaction. Currently, the following
223                                 chassis types are defined:
224                                 <literal>desktop</literal>,
225                                 <literal>laptop</literal>,
226                                 <literal>server</literal>,
227                                 <literal>tablet</literal>,
228                                 <literal>handset</literal>, as well as
229                                 the special chassis types
230                                 <literal>vm</literal> and
231                                 <literal>container</literal> for
232                                 virtualized systems that lack an
233                                 immediate physical chassis. Pass an
234                                 empty string to this operation to
235                                 reset the chassis type to the default
236                                 value which is determined from the
237                                 firmware and possibly other
238                                 parameters.</para></listitem>
239                         </varlistentry>
240
241                 </variablelist>
242         </refsect1>
243
244         <refsect1>
245                 <title>Exit status</title>
246
247                 <para>On success 0 is returned, a non-zero failure
248                 code otherwise.</para>
249         </refsect1>
250
251         <refsect1>
252                 <title>See Also</title>
253                 <para>
254                         <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
255                         <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
256                         <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
257                         <citerefentry><refentrytitle>machine-info</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
258                         <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
259                         <citerefentry><refentrytitle>systemd-hostnamed.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
260                 </para>
261         </refsect1>
262
263 </refentry>