summaryrefslogtreecommitdiff
path: root/man/hostnamectl.html
blob: 96c55a25f39441b4e28520867c41e86a1e6741d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<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 204</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 [OPTIONS...]  {COMMAND}</code> </p></div></div><div class="refsect1"><a name="idm259793979248"></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 host
                names: 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 host name 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 host name, 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="idm259793972096"></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>Don't query the user
                                for authentication for privileged
                                operations.</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 @,
                                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>set-hostname</strong></span> is
                                invoked and one or more of these
                                options are passed only the selected
                                hostnames is
                                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 host
                                name will be simplified in regards to
                                the character set used before the
                                latter are updated. This is done by
                                replacing spaces by "-" 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 "" as hostname to reset the
                                selected hostnames to their default
                                (usually
                                "localhost").</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="idm259797884656"></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="idm259797883472"></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>