]>
Commit | Line | Data |
---|---|---|
dbc4fbae LP |
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 | ||
dfdebb1b ZJS |
24 | <refentry id="hostnamectl" conditional='ENABLE_HOSTNAMED' |
25 | xmlns:xi="http://www.w3.org/2001/XInclude"> | |
dbc4fbae LP |
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> | |
960787ae ZJS |
53 | <command>hostnamectl</command> |
54 | <arg choice="opt" rep="repeat">OPTIONS</arg> | |
55 | <arg choice="req">COMMAND</arg> | |
dbc4fbae LP |
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 | |
5a5c72ca | 64 | settings.</para> |
dbc4fbae | 65 | |
e9dd9f95 JSJ |
66 | <para>This tool distinguishes three different |
67 | hostnames: the high-level "pretty" hostname which | |
68 | might include all kinds of special characters | |
dbc4fbae LP |
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 | |
c779a442 SW |
72 | which is a default received from network configuration. |
73 | If a static hostname is set, and is valid (something other | |
8d0e0ddd | 74 | than localhost), then the transient hostname is not used.</para> |
dbc4fbae LP |
75 | |
76 | <para>Note that the pretty hostname has little | |
77 | restrictions on the characters used, while the static | |
78 | and transient hostnames are limited to the usually | |
409dee2e | 79 | accepted characters of Internet domain names.</para> |
dbc4fbae | 80 | |
e9dd9f95 | 81 | <para>The static hostname is stored in |
dbc4fbae LP |
82 | <filename>/etc/hostname</filename>, see |
83 | <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
e9dd9f95 | 84 | for more information. The pretty hostname, chassis |
960787ae | 85 | type, and icon name are stored in |
dbc4fbae LP |
86 | <filename>/etc/machine-info</filename>, see |
87 | <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para> | |
88 | </refsect1> | |
89 | ||
90 | <refsect1> | |
91 | <title>Options</title> | |
92 | ||
93 | <para>The following options are understood:</para> | |
94 | ||
95 | <variablelist> | |
dbc4fbae LP |
96 | <varlistentry> |
97 | <term><option>--no-ask-password</option></term> | |
98 | ||
409dee2e | 99 | <listitem><para>Do not query the user |
dbc4fbae LP |
100 | for authentication for privileged |
101 | operations.</para></listitem> | |
102 | </varlistentry> | |
103 | ||
dbc4fbae LP |
104 | <varlistentry> |
105 | <term><option>--static</option></term> | |
106 | <term><option>--transient</option></term> | |
107 | <term><option>--pretty</option></term> | |
108 | ||
109 | <listitem><para>If | |
960787ae ZJS |
110 | <command>status</command> is used (or |
111 | no explicit command is given) and one | |
112 | of those fields is given, | |
113 | <command>hostnamectl</command> will | |
114 | print out just this selected | |
115 | hostname.</para> | |
116 | ||
117 | <para>If used with | |
118 | <command>set-hostname</command>, only | |
119 | the selected hostname(s) will be | |
120 | updated. When more than one of those | |
121 | options is used, all the specified | |
122 | hostnames will be updated. | |
123 | </para></listitem> | |
dbc4fbae | 124 | </varlistentry> |
dfdebb1b | 125 | |
4f50d2ef ZJS |
126 | <xi:include href="user-system-options.xml" xpointer="host" /> |
127 | ||
dfdebb1b ZJS |
128 | <xi:include href="standard-options.xml" xpointer="help" /> |
129 | <xi:include href="standard-options.xml" xpointer="version" /> | |
dbc4fbae LP |
130 | </variablelist> |
131 | ||
132 | <para>The following commands are understood:</para> | |
133 | ||
134 | <variablelist> | |
135 | <varlistentry> | |
136 | <term><command>status</command></term> | |
137 | ||
138 | <listitem><para>Show current system | |
139 | hostname and related | |
140 | information.</para></listitem> | |
141 | </varlistentry> | |
142 | ||
143 | <varlistentry> | |
144 | <term><command>set-hostname [NAME]</command></term> | |
145 | ||
146 | <listitem><para>Set the system | |
e9dd9f95 | 147 | hostname. By default, this will alter |
dbc4fbae | 148 | the pretty, the static, and the |
e9dd9f95 | 149 | transient hostname alike; however, if |
dbc4fbae LP |
150 | one or more of |
151 | <option>--static</option>, | |
152 | <option>--transient</option>, | |
e9dd9f95 | 153 | <option>--pretty</option> are used, |
dbc4fbae LP |
154 | only the selected hostnames are |
155 | changed. If the pretty hostname is | |
156 | being set, and static or transient are | |
e9dd9f95 JSJ |
157 | being set as well, the specified |
158 | hostname will be simplified in regards | |
159 | to the character set used before the | |
dbc4fbae | 160 | latter are updated. This is done by |
05cc7267 ZJS |
161 | replacing spaces with |
162 | <literal>-</literal> and removing | |
dbc4fbae | 163 | special characters. This ensures that |
e9dd9f95 JSJ |
164 | the pretty and the static hostname are |
165 | always closely related while still | |
dbc4fbae LP |
166 | following the validity rules of the |
167 | specific name. This simplification of | |
168 | the hostname string is not done if | |
05cc7267 ZJS |
169 | only the transient and/or static host |
170 | names are set, and the pretty host | |
171 | name is left untouched. Pass the empty | |
172 | string <literal></literal> as the | |
173 | hostname to reset the selected | |
174 | hostnames to their default (usually | |
175 | <literal>localhost</literal>).</para></listitem> | |
dbc4fbae LP |
176 | </varlistentry> |
177 | ||
178 | <varlistentry> | |
179 | <term><command>set-icon-name [NAME]</command></term> | |
180 | ||
181 | <listitem><para>Set the system icon | |
182 | name. The icon name is used by some | |
183 | graphical applications to visualize | |
184 | this host. The icon name should follow | |
185 | the <ulink | |
186 | url="http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html">Icon | |
187 | Naming Specification</ulink>. Pass an | |
5a5c72ca | 188 | empty string to this operation to |
dbc4fbae | 189 | reset the icon name to the default |
e9dd9f95 | 190 | value, which is determined from chassis |
7871c8e9 LP |
191 | type (see below) and possibly other |
192 | parameters.</para></listitem> | |
193 | </varlistentry> | |
194 | ||
195 | <varlistentry> | |
196 | <term><command>set-chassis [TYPE]</command></term> | |
197 | ||
198 | <listitem><para>Set the chassis | |
199 | type. The chassis type is used by some | |
200 | graphical applications to visualize | |
201 | the host or alter user | |
202 | interaction. Currently, the following | |
203 | chassis types are defined: | |
204 | <literal>desktop</literal>, | |
205 | <literal>laptop</literal>, | |
206 | <literal>server</literal>, | |
207 | <literal>tablet</literal>, | |
208 | <literal>handset</literal>, as well as | |
209 | the special chassis types | |
210 | <literal>vm</literal> and | |
211 | <literal>container</literal> for | |
212 | virtualized systems that lack an | |
213 | immediate physical chassis. Pass an | |
214 | empty string to this operation to | |
215 | reset the chassis type to the default | |
dbc4fbae | 216 | value which is determined from the |
7871c8e9 | 217 | firmware and possibly other |
dbc4fbae LP |
218 | parameters.</para></listitem> |
219 | </varlistentry> | |
220 | ||
221 | </variablelist> | |
222 | </refsect1> | |
223 | ||
224 | <refsect1> | |
225 | <title>Exit status</title> | |
226 | ||
b040723e | 227 | <para>On success, 0 is returned, a non-zero failure |
dbc4fbae LP |
228 | code otherwise.</para> |
229 | </refsect1> | |
230 | ||
231 | <refsect1> | |
232 | <title>See Also</title> | |
233 | <para> | |
234 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
235 | <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
236 | <citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
237 | <citerefentry><refentrytitle>machine-info</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
238 | <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
239 | <citerefentry><refentrytitle>systemd-hostnamed.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
240 | </para> | |
241 | </refsect1> | |
242 | ||
243 | </refentry> |