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