chiark / gitweb /
man: fix link to strerror(3)
[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     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 query and
63     change the system hostname and related settings.</para>
64
65     <para>This tool distinguishes three different hostnames: the
66     high-level "pretty" hostname which might include all kinds of
67     special characters (e.g. "Lennart's Laptop"), the static hostname
68     which is used to initialize the kernel hostname at boot (e.g.
69     "lennarts-laptop"), and the transient hostname which is a default
70     received from network configuration. If a static hostname is set,
71     and is valid (something other than localhost), then the transient
72     hostname is not used.</para>
73
74     <para>Note that the pretty hostname has little restrictions on the
75     characters used, while the static and transient hostnames are
76     limited to the usually accepted characters of Internet domain
77     names.</para>
78
79     <para>The static hostname is stored in
80     <filename>/etc/hostname</filename>, see
81     <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>5</manvolnum></citerefentry>
82     for more information. The pretty hostname, chassis type, and icon
83     name are stored in <filename>/etc/machine-info</filename>, see
84     <citerefentry><refentrytitle>machine-info</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
85
86     <para>Use
87     <citerefentry><refentrytitle>systemd-firstboot</refentrytitle><manvolnum>1</manvolnum></citerefentry>
88     to initialize the system host name for mounted (but not booted)
89     system images.</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 for authentication for
102         privileged operations.</para></listitem>
103       </varlistentry>
104
105       <varlistentry>
106         <term><option>--static</option></term>
107         <term><option>--transient</option></term>
108         <term><option>--pretty</option></term>
109
110         <listitem><para>If <command>status</command> is used (or no
111         explicit command is given) and one of those fields is given,
112         <command>hostnamectl</command> will print out just this
113         selected hostname.</para>
114
115         <para>If used with <command>set-hostname</command>, only the
116         selected hostname(s) will be updated. When more than one of
117         those options is used, all the specified hostnames will be
118         updated. </para></listitem>
119       </varlistentry>
120
121       <xi:include href="user-system-options.xml" xpointer="host" />
122       <xi:include href="user-system-options.xml" xpointer="machine" />
123
124       <xi:include href="standard-options.xml" xpointer="help" />
125       <xi:include href="standard-options.xml" xpointer="version" />
126     </variablelist>
127
128     <para>The following commands are understood:</para>
129
130     <variablelist>
131       <varlistentry>
132         <term><command>status</command></term>
133
134         <listitem><para>Show current system
135         hostname and related
136         information.</para></listitem>
137       </varlistentry>
138
139       <varlistentry>
140         <term><command>set-hostname <replaceable>NAME</replaceable></command></term>
141
142         <listitem><para>Set the system hostname to
143         <replaceable>NAME</replaceable>. By default, this will alter
144         the pretty, the static, and the transient hostname alike;
145         however, if one or more of <option>--static</option>,
146         <option>--transient</option>, <option>--pretty</option> are
147         used, only the selected hostnames are changed. If the pretty
148         hostname is being set, and static or transient are being set
149         as well, the specified hostname will be simplified in regards
150         to the character set used before the latter are updated. This
151         is done by replacing spaces with <literal>-</literal> and
152         removing special characters. This ensures that the pretty and
153         the static hostname are always closely related while still
154         following the validity rules of the specific name. This
155         simplification of the hostname string is not done if only the
156         transient and/or static host names are set, and the pretty
157         host name is left untouched.</para>
158
159         <para>Pass the empty string <literal></literal> as the
160         hostname to reset the selected hostnames to their default
161         (usually <literal>localhost</literal>).</para></listitem>
162       </varlistentry>
163
164       <varlistentry>
165         <term><command>set-icon-name <replaceable>NAME</replaceable></command></term>
166
167         <listitem><para>Set the system icon name to
168         <replaceable>NAME</replaceable>. The icon name is used by some
169         graphical applications to visualize this host. The icon name
170         should follow the <ulink
171         url="http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html">Icon
172         Naming Specification</ulink>.</para>
173
174         <para>Pass an empty string to reset the icon name to the
175         default value, which is determined from chassis type (see
176         below) and possibly other parameters.</para></listitem>
177       </varlistentry>
178
179       <varlistentry>
180         <term><command>set-chassis <replaceable>TYPE</replaceable></command></term>
181
182         <listitem><para>Set the chassis type to
183         <replaceable>TYPE</replaceable>. The chassis type is used by
184         some graphical applications to visualize the host or alter
185         user interaction. Currently, the following chassis types are
186         defined:
187         <literal>desktop</literal>,
188         <literal>laptop</literal>,
189         <literal>server</literal>,
190         <literal>tablet</literal>,
191         <literal>handset</literal>,
192         <literal>watch</literal>,
193         <literal>embedded</literal>,
194         as well as the special chassis types
195         <literal>vm</literal> and
196         <literal>container</literal> for virtualized systems that lack
197         an immediate physical chassis.</para>
198
199         <para>Pass an empty string to reset the chassis type to the
200         default value which is determined from the firmware and
201         possibly other parameters.</para>
202         </listitem>
203       </varlistentry>
204
205       <varlistentry>
206         <term><command>set-deployment <replaceable>ENVIRONMENT</replaceable></command></term>
207
208         <listitem><para>Set the deployment environment description.
209         <replaceable>ENVIRONMENT</replaceable> must be a single word
210         without any control characters. One of the following is
211         suggested:
212         <literal>development</literal>,
213         <literal>integration</literal>,
214         <literal>staging</literal>,
215         <literal>production</literal>.
216         </para>
217
218         <para>Pass an empty string to reset to the default empty
219         value.</para>
220         </listitem>
221       </varlistentry>
222
223       <varlistentry>
224         <term><command>set-location <replaceable>LOCATION</replaceable></command></term>
225
226         <listitem><para>Set the location string for the system, if it
227         is known. <replaceable>LOCATION</replaceable> should be a
228         human-friendly, free-form string describing the physical
229         location of the system, if it is known and applicable. This
230         may be as generic as <literal>Berlin, Germany</literal> or as
231         specific as <literal>Left Rack, 2nd Shelf</literal>.</para>
232
233         <para>Pass an empty string to reset to the default empty
234         value.</para>
235         </listitem>
236       </varlistentry>
237     </variablelist>
238   </refsect1>
239
240   <refsect1>
241     <title>Exit status</title>
242
243     <para>On success, 0 is returned, a non-zero failure code
244     otherwise.</para>
245   </refsect1>
246
247   <refsect1>
248     <title>See Also</title>
249     <para>
250       <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
251       <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
252       <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
253       <citerefentry><refentrytitle>machine-info</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
254       <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
255       <citerefentry><refentrytitle>systemd-hostnamed.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
256       <citerefentry><refentrytitle>systemd-firstboot</refentrytitle><manvolnum>1</manvolnum></citerefentry>
257     </para>
258   </refsect1>
259
260 </refentry>