Debian Codegraph @

upstream/debian-unstable/man1/hostnamectl.1

raw
1 '\" t
2 .TH "HOSTNAMECTL" "1" "" "systemd 261~rc3" "hostnamectl"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 hostnamectl \- Control the system hostname
24 .SH "SYNOPSIS"
25 .HP \w'\fBhostnamectl\fR\ 'u
26 \fBhostnamectl\fR [OPTIONS...] {COMMAND}
27 .SH "DESCRIPTION"
28 .PP
29 \fBhostnamectl\fR
30 may be used to query and change the system hostname and related settings\&.
31 .PP
32 \fBsystemd-hostnamed.service\fR(8)
33 and this tool distinguish three different hostnames: the high\-level "pretty" hostname which might include all kinds of special characters (e\&.g\&. "Lennart\*(Aqs Laptop"), the "static" hostname which is the user\-configured hostname (e\&.g\&. "lennarts\-laptop"), and the transient hostname which is a fallback value received from network configuration (e\&.g\&. "node12345678")\&. If a static hostname is set to a valid value, then the transient hostname is not used\&.
34 .PP
35 Note that the pretty hostname has little restrictions on the characters and length used, while the static and transient hostnames are limited to the usually accepted characters of Internet domain names, and 64 characters at maximum (the latter being a Linux limitation)\&.
36 .PP
37 Use
38 \fBsystemd-firstboot\fR(1)
39 to initialize the system hostname for mounted (but not booted) system images\&.
40 .SH "COMMANDS"
41 .PP
42 The following commands are understood:
43 .PP
44 \fBstatus\fR
45 .RS 4
46 Show system hostname and related information\&. If no command is specified, this is the implied default\&.
47 .sp
48 Added in version 195\&.
49 .RE
50 .PP
51 \fBhostname\fR [\fINAME\fR]
52 .RS 4
53 If no argument is given, print the system hostname\&. If an optional argument
54 \fINAME\fR
55 is provided then the command changes the system hostname to
56 \fINAME\fR\&. By default, this will alter the pretty, the static, and the transient hostname alike; however, if one or more of
57 \fB\-\-static\fR,
58 \fB\-\-transient\fR,
59 \fB\-\-pretty\fR
60 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 removing special characters and spaces\&. 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 hostnames are set, and the pretty hostname is left untouched\&.
61 .sp
62 The static and transient hostnames must each be either a single DNS label (a string composed of 7\-bit ASCII lower\-case characters and no spaces or dots, limited to the format allowed for DNS domain name labels), or a sequence of such labels separated by single dots that forms a valid DNS FQDN\&. The hostname must be at most 64 characters, which is a Linux limitation (DNS allows longer names)\&.
63 .sp
64 If the question mark character
65 "?"
66 appears in the hostname, it is automatically substituted by a hexadecimal character derived from the
67 \fBmachine-id\fR(5)
68 when applied, securely and deterministically by cryptographic hashing\&. Example:
69 "foobar\-????\-????"
70 will automatically expand to
71 "foobar\-92a9\-061c"
72 or similar, depending on the local machine ID\&.
73 .sp
74 Added in version 249\&.
75 .RE
76 .PP
77 \fBicon\-name\fR [\fINAME\fR]
78 .RS 4
79 If no argument is given, print the icon name of the system\&. If an optional argument
80 \fINAME\fR
81 is provided then the command changes the icon name to
82 \fINAME\fR\&. The icon name is used by some graphical applications to visualize this host\&. The icon name should follow the
83 \m[blue]\fBIcon Naming Specification\fR\m[]\&\s-2\u[1]\d\s+2\&.
84 .sp
85 Added in version 249\&.
86 .RE
87 .PP
88 \fBchassis\fR [\fITYPE\fR]
89 .RS 4
90 If no argument is given, print the chassis type\&. If an optional argument
91 \fITYPE\fR
92 is provided then the command changes the chassis type to
93 \fITYPE\fR\&. The chassis type is used by some graphical applications to visualize the host or alter user interaction\&. Currently, the following chassis types are defined:
94 "desktop",
95 "laptop",
96 "convertible",
97 "server",
98 "tablet",
99 "handset",
100 "watch",
101 "embedded", as well as the special chassis types
102 "vm"
103 and
104 "container"
105 for virtualized systems that lack an immediate physical chassis\&.
106 .sp
107 Added in version 249\&.
108 .RE
109 .PP
110 \fBdeployment\fR [\fIENVIRONMENT\fR]
111 .RS 4
112 If no argument is given, print the deployment environment\&. If an optional argument
113 \fIENVIRONMENT\fR
114 is provided then the command changes the deployment environment to
115 \fIENVIRONMENT\fR\&. Argument
116 \fIENVIRONMENT\fR
117 must be a single word without any control characters\&. One of the following is suggested:
118 "development",
119 "integration",
120 "staging",
121 "production"\&.
122 .sp
123 Added in version 249\&.
124 .RE
125 .PP
126 \fBlocation\fR [\fILOCATION\fR]
127 .RS 4
128 If no argument is given, print the location string for the system\&. If an optional argument
129 \fILOCATION\fR
130 is provided then the command changes the location string for the system to
131 \fILOCATION\fR\&. Argument
132 \fILOCATION\fR
133 should be a human\-friendly, free\-form string describing the physical location of the system, if it is known and applicable\&. This may be as generic as
134 "Berlin, Germany"
135 or as specific as
136 "Left Rack, 2nd Shelf"\&.
137 .sp
138 Added in version 249\&.
139 .RE
140 .PP
141 \fBtags\fR [\fITAG\fR\&...]
142 .RS 4
143 If no argument is given, print the machine tags currently configured, as a colon\-separated list\&. If one or more
144 \fITAG\fR
145 arguments are provided then the command replaces the configured tags with the specified ones\&. Each argument may itself be a colon\-separated list of tags, so that the tags may be specified either as multiple arguments or as a single colon\-separated argument, or any combination thereof\&. Duplicate tags are removed and the resulting list is sorted before being stored\&. To remove all tags, invoke the command with a single empty string argument\&.
146 .sp
147 Machine tags are short labels that may be used to classify and group machines for management purposes, for example to identify the role a machine plays in a deployment, the fleet or organizational unit it belongs to, or any other administrator\-defined attribute\&. Each individual tag must be 1\&...255 characters long and consist only of ASCII alphanumeric characters,
148 "\-"
149 and
150 "\&."\&. The tags are stored in the
151 \fITAGS=\fR
152 field of
153 /etc/machine\-info; see
154 \fBmachine-info\fR(5)
155 for details\&. They may also be matched against with the
156 \fIConditionMachineTag=\fR/\fIAssertMachineTag=\fR
157 unit settings, see
158 \fBsystemd.unit\fR(5)\&.
159 .sp
160 Added in version 261\&.
161 .RE
162 .SH "OPTIONS"
163 .PP
164 The following options are understood:
165 .PP
166 \fB\-\-static\fR, \fB\-\-transient\fR, \fB\-\-pretty\fR
167 .RS 4
168 If
169 \fBstatus\fR
170 is invoked (or no explicit command is given) and one of these switches is specified,
171 \fBhostnamectl\fR
172 will print out just this selected hostname\&.
173 .sp
174 If used with
175 \fBhostname\fR, only the selected hostnames will be updated\&. When more than one of these switches are specified, all the specified hostnames will be updated\&.
176 .sp
177 Added in version 195\&.
178 .RE
179 .PP
180 \fB\-H\fR, \fB\-\-host=\fR
181 .RS 4
182 Execute the operation remotely\&. Specify a hostname, or a username and hostname separated by
183 "@", to connect to\&. The hostname may optionally be suffixed by a port ssh is listening on, separated by
184 ":", and then a container name, separated by
185 "/", which connects directly to a specific container on the specified host\&. This will use SSH to talk to the remote machine manager instance\&. Container names may be enumerated with
186 \fBmachinectl \-H \fR\fB\fIHOST\fR\fR\&. Put IPv6 addresses in brackets\&.
187 .RE
188 .PP
189 \fB\-M\fR, \fB\-\-machine=\fR
190 .RS 4
191 Execute operation on a local container\&. Specify a container name to connect to, optionally prefixed by a user name to connect as and a separating
192 "@"
193 character\&. If the special string
194 "\&.host"
195 is used in place of the container name, a connection to the local system is made (which is useful to connect to a specific user\*(Aqs user bus:
196 "\-\-user \-\-machine=lennart@\&.host")\&. If the
197 "@"
198 syntax is not used, the connection is made as root user\&. If the
199 "@"
200 syntax is used either the left hand side or the right hand side may be omitted (but not both) in which case the local user name and
201 "\&.host"
202 are implied\&.
203 .RE
204 .PP
205 \fB\-\-no\-ask\-password\fR
206 .RS 4
207 Do not query the user for authentication for privileged operations\&.
208 .RE
209 .PP
210 \fB\-h\fR, \fB\-\-help\fR
211 .RS 4
212 Print a short help text and exit\&.
213 .RE
214 .PP
215 \fB\-\-version\fR
216 .RS 4
217 Print a short version string and exit\&.
218 .RE
219 .PP
220 \fB\-\-json=\fR\fB\fIMODE\fR\fR
221 .RS 4
222 Shows output formatted as JSON\&. Expects one of
223 "short"
224 (for the shortest possible output without any redundant whitespace or line breaks),
225 "pretty"
226 (for a pretty version of the same, with indentation and line breaks) or
227 "off"
228 (to turn off JSON output, the default)\&.
229 .RE
230 .PP
231 \fB\-j\fR
232 .RS 4
233 Equivalent to
234 \fB\-\-json=pretty\fR
235 if running on a terminal, and
236 \fB\-\-json=short\fR
237 otherwise\&.
238 .RE
239 .SH "EXIT STATUS"
240 .PP
241 On success, 0 is returned, a non\-zero failure code otherwise\&.
242 .SH "SEE ALSO"
243 .PP
244 \fBsystemd\fR(1), \fBhostname\fR(1), \fBhostname\fR(5), \fBmachine-info\fR(5), \fBsystemctl\fR(1), \fBsystemd-hostnamed.service\fR(8), \fBsystemd-firstboot\fR(1)
245 .SH "NOTES"
246 .IP " 1." 4
247 Icon Naming Specification
248 .RS 4
249 \%https://specifications.freedesktop.org/icon-naming/latest
250 .RE