mirror of
https://git.proxmox.com/git/systemd
synced 2026-01-16 05:20:51 +00:00
135 lines
12 KiB
HTML
135 lines
12 KiB
HTML
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>hostnamectl</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><style>
|
|
a.headerlink {
|
|
color: #c60f0f;
|
|
font-size: 0.8em;
|
|
padding: 0 4px 0 4px;
|
|
text-decoration: none;
|
|
visibility: hidden;
|
|
}
|
|
|
|
a.headerlink:hover {
|
|
background-color: #c60f0f;
|
|
color: white;
|
|
}
|
|
|
|
h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
|
|
visibility: visible;
|
|
}
|
|
</style><a href="index.html">Index </a>·
|
|
<a href="systemd.directives.html">Directives </a>·
|
|
<a href="../python-systemd/index.html">Python </a>·
|
|
<a href="../libudev/index.html">libudev </a>·
|
|
<a href="../libudev/index.html">gudev </a><span style="float:right">systemd 208</span><hr><div class="refentry"><a name="hostnamectl"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>hostnamectl — Control the system hostname</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">hostnamectl</code> [OPTIONS...] {COMMAND}</p></div></div><div class="refsect1"><a name="idm274699518528"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description">¶</a></h2><p><span class="command"><strong>hostnamectl</strong></span> may be used to
|
|
query and change the system hostname and related
|
|
settings.</p><p>This tool distinguishes three different
|
|
hostnames: the high-level "pretty" hostname which
|
|
might include all kinds of special characters
|
|
(e.g. "Lennart's Laptop"), the static hostname which
|
|
is used to initialize the kernel hostname at boot
|
|
(e.g. "lennarts-laptop"), and the transient hostname
|
|
which might be assigned temporarily due to network
|
|
configuration and might revert back to the static
|
|
hostname if network connectivity is lost and is only
|
|
temporarily written to the kernel hostname
|
|
(e.g. "dhcp-47-11").</p><p>Note that the pretty hostname has little
|
|
restrictions on the characters used, while the static
|
|
and transient hostnames are limited to the usually
|
|
accepted characters of Internet domain names.</p><p>The static hostname is stored in
|
|
<code class="filename">/etc/hostname</code>, see
|
|
<a href="hostname.html"><span class="citerefentry"><span class="refentrytitle">hostname</span>(5)</span></a>
|
|
for more information. The pretty hostname, chassis
|
|
type, and icon name are stored in
|
|
<code class="filename">/etc/machine-info</code>, see
|
|
<a href="machine-id.html"><span class="citerefentry"><span class="refentrytitle">machine-id</span>(5)</span></a>.</p></div><div class="refsect1"><a name="idm274699440976"></a><h2 id="Options">Options<a class="headerlink" title="Permalink to this headline" href="#Options">¶</a></h2><p>The following options are understood:</p><div class="variablelist"><dl class="variablelist"><dt id="-h"><span class="term"><code class="option">-h</code>, </span><span class="term"><code class="option">--help</code></span><a class="headerlink" title="Permalink to this term" href="#-h">¶</a></dt><dd><p>Prints a short help
|
|
text and exits.</p></dd><dt id="--version"><span class="term"><code class="option">--version</code></span><a class="headerlink" title="Permalink to this term" href="#--version">¶</a></dt><dd><p>Prints a short version
|
|
string and exits.</p></dd><dt id="--no-ask-password"><span class="term"><code class="option">--no-ask-password</code></span><a class="headerlink" title="Permalink to this term" href="#--no-ask-password">¶</a></dt><dd><p>Do not query the user
|
|
for authentication for privileged
|
|
operations.</p></dd><dt id="-P"><span class="term"><code class="option">-P</code>, </span><span class="term"><code class="option">--privileged</code></span><a class="headerlink" title="Permalink to this term" href="#-P">¶</a></dt><dd><p>Acquire privileges via PolicyKit
|
|
before executing the operation.</p></dd><dt id="-H"><span class="term"><code class="option">-H</code>, </span><span class="term"><code class="option">--host</code></span><a class="headerlink" title="Permalink to this term" href="#-H">¶</a></dt><dd><p>Execute the operation
|
|
remotely. Specify a hostname, or
|
|
username and hostname separated by "<code class="literal">@</code>",
|
|
to connect to. This will use SSH to
|
|
talk to a remote
|
|
system.</p></dd><dt id="--static"><span class="term"><code class="option">--static</code>, </span><span class="term"><code class="option">--transient</code>, </span><span class="term"><code class="option">--pretty</code></span><a class="headerlink" title="Permalink to this term" href="#--static">¶</a></dt><dd><p>If
|
|
<span class="command"><strong>status</strong></span> is used (or
|
|
no explicit command is given) and one
|
|
of those fields is given,
|
|
<span class="command"><strong>hostnamectl</strong></span> will
|
|
print out just this selected
|
|
hostname.</p><p>If used with
|
|
<span class="command"><strong>set-hostname</strong></span>, only
|
|
the selected hostname(s) will be
|
|
updated. When more than one of those
|
|
options is used, all the specified
|
|
hostnames will be updated.
|
|
</p></dd></dl></div><p>The following commands are understood:</p><div class="variablelist"><dl class="variablelist"><dt id="status"><span class="term"><span class="command"><strong>status</strong></span></span><a class="headerlink" title="Permalink to this term" href="#status">¶</a></dt><dd><p>Show current system
|
|
hostname and related
|
|
information.</p></dd><dt id="set-hostname [NAME]"><span class="term"><span class="command"><strong>set-hostname [NAME]</strong></span></span><a class="headerlink" title="Permalink to this term" href="#set-hostname%20%5BNAME%5D">¶</a></dt><dd><p>Set the system
|
|
hostname. By default, this will alter
|
|
the pretty, the static, and the
|
|
transient hostname alike; however, if
|
|
one or more of
|
|
<code class="option">--static</code>,
|
|
<code class="option">--transient</code>,
|
|
<code class="option">--pretty</code> are used,
|
|
only the selected hostnames are
|
|
changed. If the pretty hostname is
|
|
being set, and static or transient are
|
|
being set as well, the specified
|
|
hostname will be simplified in regards
|
|
to the character set used before the
|
|
latter are updated. This is done by
|
|
replacing spaces with
|
|
"<code class="literal">-</code>" and removing
|
|
special characters. This ensures that
|
|
the pretty and the static hostname are
|
|
always closely related while still
|
|
following the validity rules of the
|
|
specific name. This simplification of
|
|
the hostname string is not done if
|
|
only the transient and/or static host
|
|
names are set, and the pretty host
|
|
name is left untouched. Pass the empty
|
|
string "<code class="literal"></code>" as the
|
|
hostname to reset the selected
|
|
hostnames to their default (usually
|
|
"<code class="literal">localhost</code>").</p></dd><dt id="set-icon-name [NAME]"><span class="term"><span class="command"><strong>set-icon-name [NAME]</strong></span></span><a class="headerlink" title="Permalink to this term" href="#set-icon-name%20%5BNAME%5D">¶</a></dt><dd><p>Set the system icon
|
|
name. The icon name is used by some
|
|
graphical applications to visualize
|
|
this host. The icon name should follow
|
|
the <a class="ulink" href="http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html" target="_top">Icon
|
|
Naming Specification</a>. Pass an
|
|
empty string to this operation to
|
|
reset the icon name to the default
|
|
value, which is determined from chassis
|
|
type (see below) and possibly other
|
|
parameters.</p></dd><dt id="set-chassis [TYPE]"><span class="term"><span class="command"><strong>set-chassis [TYPE]</strong></span></span><a class="headerlink" title="Permalink to this term" href="#set-chassis%20%5BTYPE%5D">¶</a></dt><dd><p>Set the chassis
|
|
type. The chassis type is used by some
|
|
graphical applications to visualize
|
|
the host or alter user
|
|
interaction. Currently, the following
|
|
chassis types are defined:
|
|
"<code class="literal">desktop</code>",
|
|
"<code class="literal">laptop</code>",
|
|
"<code class="literal">server</code>",
|
|
"<code class="literal">tablet</code>",
|
|
"<code class="literal">handset</code>", as well as
|
|
the special chassis types
|
|
"<code class="literal">vm</code>" and
|
|
"<code class="literal">container</code>" for
|
|
virtualized systems that lack an
|
|
immediate physical chassis. Pass an
|
|
empty string to this operation to
|
|
reset the chassis type to the default
|
|
value which is determined from the
|
|
firmware and possibly other
|
|
parameters.</p></dd></dl></div></div><div class="refsect1"><a name="idm274699542496"></a><h2 id="Exit status">Exit status<a class="headerlink" title="Permalink to this headline" href="#Exit%20status">¶</a></h2><p>On success 0 is returned, a non-zero failure
|
|
code otherwise.</p></div><div class="refsect1"><a name="idm274699541312"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also">¶</a></h2><p>
|
|
<a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
|
|
<a href="hostname.html"><span class="citerefentry"><span class="refentrytitle">hostname</span>(1)</span></a>,
|
|
<a href="hostname.html"><span class="citerefentry"><span class="refentrytitle">hostname</span>(5)</span></a>,
|
|
<a href="machine-info.html"><span class="citerefentry"><span class="refentrytitle">machine-info</span>(5)</span></a>,
|
|
<a href="systemctl.html"><span class="citerefentry"><span class="refentrytitle">systemctl</span>(1)</span></a>,
|
|
<a href="systemd-hostnamed.service.html"><span class="citerefentry"><span class="refentrytitle">systemd-hostnamed.service</span>(8)</span></a>
|
|
</p></div></div></body></html>
|