Debian Codegraph @

upstream/debian-trixie/man1/hostnamectl.1

raw
1 '\" t
2 .TH "HOSTNAMECTL" "1" "" "systemd 257.13" "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 Added in version 249\&.
65 .RE
66 .PP
67 \fBicon\-name\fR [\fINAME\fR]
68 .RS 4
69 If no argument is given, print the icon name of the system\&. If an optional argument
70 \fINAME\fR
71 is provided then the command changes the icon name to
72 \fINAME\fR\&. The icon name is used by some graphical applications to visualize this host\&. The icon name should follow the
73 \m[blue]\fBIcon Naming Specification\fR\m[]\&\s-2\u[1]\d\s+2\&.
74 .sp
75 Added in version 249\&.
76 .RE
77 .PP
78 \fBchassis\fR [\fITYPE\fR]
79 .RS 4
80 If no argument is given, print the chassis type\&. If an optional argument
81 \fITYPE\fR
82 is provided then the command changes the chassis type to
83 \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:
84 "desktop",
85 "laptop",
86 "convertible",
87 "server",
88 "tablet",
89 "handset",
90 "watch",
91 "embedded", as well as the special chassis types
92 "vm"
93 and
94 "container"
95 for virtualized systems that lack an immediate physical chassis\&.
96 .sp
97 Added in version 249\&.
98 .RE
99 .PP
100 \fBdeployment\fR [\fIENVIRONMENT\fR]
101 .RS 4
102 If no argument is given, print the deployment environment\&. If an optional argument
103 \fIENVIRONMENT\fR
104 is provided then the command changes the deployment environment to
105 \fIENVIRONMENT\fR\&. Argument
106 \fIENVIRONMENT\fR
107 must be a single word without any control characters\&. One of the following is suggested:
108 "development",
109 "integration",
110 "staging",
111 "production"\&.
112 .sp
113 Added in version 249\&.
114 .RE
115 .PP
116 \fBlocation\fR [\fILOCATION\fR]
117 .RS 4
118 If no argument is given, print the location string for the system\&. If an optional argument
119 \fILOCATION\fR
120 is provided then the command changes the location string for the system to
121 \fILOCATION\fR\&. Argument
122 \fILOCATION\fR
123 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
124 "Berlin, Germany"
125 or as specific as
126 "Left Rack, 2nd Shelf"\&.
127 .sp
128 Added in version 249\&.
129 .RE
130 .SH "OPTIONS"
131 .PP
132 The following options are understood:
133 .PP
134 \fB\-\-static\fR, \fB\-\-transient\fR, \fB\-\-pretty\fR
135 .RS 4
136 If
137 \fBstatus\fR
138 is invoked (or no explicit command is given) and one of these switches is specified,
139 \fBhostnamectl\fR
140 will print out just this selected hostname\&.
141 .sp
142 If used with
143 \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\&.
144 .sp
145 Added in version 195\&.
146 .RE
147 .PP
148 \fB\-H\fR, \fB\-\-host=\fR
149 .RS 4
150 Execute the operation remotely\&. Specify a hostname, or a username and hostname separated by
151 "@", to connect to\&. The hostname may optionally be suffixed by a port ssh is listening on, separated by
152 ":", and then a container name, separated by
153 "/", 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
154 \fBmachinectl \-H \fR\fB\fIHOST\fR\fR\&. Put IPv6 addresses in brackets\&.
155 .RE
156 .PP
157 \fB\-M\fR, \fB\-\-machine=\fR
158 .RS 4
159 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
160 "@"
161 character\&. If the special string
162 "\&.host"
163 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:
164 "\-\-user \-\-machine=lennart@\&.host")\&. If the
165 "@"
166 syntax is not used, the connection is made as root user\&. If the
167 "@"
168 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
169 "\&.host"
170 are implied\&.
171 .RE
172 .PP
173 \fB\-\-no\-ask\-password\fR
174 .RS 4
175 Do not query the user for authentication for privileged operations\&.
176 .RE
177 .PP
178 \fB\-h\fR, \fB\-\-help\fR
179 .RS 4
180 Print a short help text and exit\&.
181 .RE
182 .PP
183 \fB\-\-version\fR
184 .RS 4
185 Print a short version string and exit\&.
186 .RE
187 .PP
188 \fB\-\-json=\fR\fB\fIMODE\fR\fR
189 .RS 4
190 Shows output formatted as JSON\&. Expects one of
191 "short"
192 (for the shortest possible output without any redundant whitespace or line breaks),
193 "pretty"
194 (for a pretty version of the same, with indentation and line breaks) or
195 "off"
196 (to turn off JSON output, the default)\&.
197 .RE
198 .PP
199 \fB\-j\fR
200 .RS 4
201 Equivalent to
202 \fB\-\-json=pretty\fR
203 if running on a terminal, and
204 \fB\-\-json=short\fR
205 otherwise\&.
206 .RE
207 .SH "EXIT STATUS"
208 .PP
209 On success, 0 is returned, a non\-zero failure code otherwise\&.
210 .SH "SEE ALSO"
211 .PP
212 \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)
213 .SH "NOTES"
214 .IP " 1." 4
215 Icon Naming Specification
216 .RS 4
217 \%https://specifications.freedesktop.org/icon-naming/latest
218 .RE