1TIMEDATECTL(1) timedatectl TIMEDATECTL(1)
2
3
4
6 timedatectl - Control the system time and date
7
9 timedatectl [OPTIONS...] {COMMAND}
10
12 timedatectl may be used to query and change the system clock and its
13 settings, and enable or disable time synchronization services.
14
15 Use systemd-firstboot(1) to initialize the system time zone for mounted
16 (but not booted) system images.
17
18 timedatectl may be used to show the current status of time
19 synchronization services, for example systemd-timesyncd.service(8).
20
22 The following commands are understood:
23
24 status
25 Show current settings of the system clock and RTC, including
26 whether network time synchronization is active. If no command is
27 specified, this is the implied default.
28
29 show
30 Show the same information as status, but in machine readable form.
31 This command is intended to be used whenever computer-parsable
32 output is required. Use status if you are looking for formatted
33 human-readable output.
34
35 By default, empty properties are suppressed. Use --all to show
36 those too. To select specific properties to show, use --property=.
37
38 set-time [TIME]
39 Set the system clock to the specified time. This will also update
40 the RTC time accordingly. The time may be specified in the format
41 "2012-10-30 18:17:16".
42
43 set-timezone [TIMEZONE]
44 Set the system time zone to the specified value. Available
45 timezones can be listed with list-timezones. If the RTC is
46 configured to be in the local time, this will also update the RTC
47 time. This call will alter the /etc/localtime symlink. See
48 localtime(5) for more information.
49
50 list-timezones
51 List available time zones, one per line. Entries from the list can
52 be set as the system timezone with set-timezone.
53
54 set-local-rtc [BOOL]
55 Takes a boolean argument. If "0", the system is configured to
56 maintain the RTC in universal time. If "1", it will maintain the
57 RTC in local time instead. Note that maintaining the RTC in the
58 local timezone is not fully supported and will create various
59 problems with time zone changes and daylight saving adjustments. If
60 at all possible, keep the RTC in UTC mode. Note that invoking this
61 will also synchronize the RTC from the system clock, unless
62 --adjust-system-clock is passed (see above). This command will
63 change the 3rd line of /etc/adjtime, as documented in hwclock(8).
64
65 set-ntp [BOOL]
66 Takes a boolean argument. Controls whether network time
67 synchronization is active and enabled (if available). If the
68 argument is true, this enables and starts the first existing
69 network synchronization service. If the argument is false, then
70 this disables and stops the known network synchronization services.
71 The way that the list of services is built is described in systemd-
72 timedated.service(8).
73
74 systemd-timesyncd Commands
75 The following commands are specific to systemd-timesyncd.service(8).
76
77 timesync-status
78 Show current status of systemd-timesyncd.service(8). If --monitor
79 is specified, then this will monitor the status updates.
80
81 show-timesync
82 Show the same information as timesync-status, but in machine
83 readable form. This command is intended to be used whenever
84 computer-parsable output is required. Use timesync-status if you
85 are looking for formatted human-readable output.
86
87 By default, empty properties are suppressed. Use --all to show
88 those too. To select specific properties to show, use --property=.
89
90 ntp-servers INTERFACE SERVER...
91 Set the interface specific NTP servers. This command can be used
92 only when the interface is managed by systemd-networkd.
93
94 revert INTERFACE
95 Revert the interface specific NTP servers. This command can be used
96 only when the interface is managed by systemd-networkd.
97
99 The following options are understood:
100
101 --no-ask-password
102 Do not query the user for authentication for privileged operations.
103
104 --adjust-system-clock
105 If set-local-rtc is invoked and this option is passed, the system
106 clock is synchronized from the RTC again, taking the new setting
107 into account. Otherwise, the RTC is synchronized from the system
108 clock.
109
110 --monitor
111 If timesync-status is invoked and this option is passed, then
112 timedatectl monitors the status of systemd-timesyncd.service(8) and
113 updates the outputs. Use Ctrl+C to terminate the monitoring.
114
115 -a, --all
116 When showing properties of systemd-timesyncd.service(8), show all
117 properties regardless of whether they are set or not.
118
119 -p, --property=
120 When showing properties of systemd-timesyncd.service(8), limit
121 display to certain properties as specified as argument. If not
122 specified, all set properties are shown. The argument should be a
123 property name, such as "ServerName". If specified more than once,
124 all properties with the specified names are shown.
125
126 --value
127 When printing properties with show-timesync, only print the value,
128 and skip the property name and "=".
129
130 -H, --host=
131 Execute the operation remotely. Specify a hostname, or a username
132 and hostname separated by "@", to connect to. The hostname may
133 optionally be suffixed by a port ssh is listening on, separated by
134 ":", and then a container name, separated by "/", which connects
135 directly to a specific container on the specified host. This will
136 use SSH to talk to the remote machine manager instance. Container
137 names may be enumerated with machinectl -H HOST. Put IPv6 addresses
138 in brackets.
139
140 -M, --machine=
141 Execute operation on a local container. Specify a container name to
142 connect to, optionally prefixed by a user name to connect as and a
143 separating "@" character. If the special string ".host" is used in
144 place of the container name, a connection to the local system is
145 made (which is useful to connect to a specific user's user bus:
146 "--user --machine=lennart@.host"). If the "@" syntax is not used,
147 the connection is made as root user. If the "@" syntax is used
148 either the left hand side or the right hand side may be omitted
149 (but not both) in which case the local user name and ".host" are
150 implied.
151
152 -h, --help
153 Print a short help text and exit.
154
155 --version
156 Print a short version string and exit.
157
158 --no-pager
159 Do not pipe output into a pager.
160
162 On success, 0 is returned, a non-zero failure code otherwise.
163
165 $SYSTEMD_LOG_LEVEL
166 The maximum log level of emitted messages (messages with a higher
167 log level, i.e. less important ones, will be suppressed). Either
168 one of (in order of decreasing importance) emerg, alert, crit, err,
169 warning, notice, info, debug, or an integer in the range 0...7. See
170 syslog(3) for more information.
171
172 $SYSTEMD_LOG_COLOR
173 A boolean. If true, messages written to the tty will be colored
174 according to priority.
175
176 This setting is only useful when messages are written directly to
177 the terminal, because journalctl(1) and other tools that display
178 logs will color messages based on the log level on their own.
179
180 $SYSTEMD_LOG_TIME
181 A boolean. If true, console log messages will be prefixed with a
182 timestamp.
183
184 This setting is only useful when messages are written directly to
185 the terminal or a file, because journalctl(1) and other tools that
186 display logs will attach timestamps based on the entry metadata on
187 their own.
188
189 $SYSTEMD_LOG_LOCATION
190 A boolean. If true, messages will be prefixed with a filename and
191 line number in the source code where the message originates.
192
193 Note that the log location is often attached as metadata to journal
194 entries anyway. Including it directly in the message text can
195 nevertheless be convenient when debugging programs.
196
197 $SYSTEMD_LOG_TID
198 A boolean. If true, messages will be prefixed with the current
199 numerical thread ID (TID).
200
201 Note that the this information is attached as metadata to journal
202 entries anyway. Including it directly in the message text can
203 nevertheless be convenient when debugging programs.
204
205 $SYSTEMD_LOG_TARGET
206 The destination for log messages. One of console (log to the
207 attached tty), console-prefixed (log to the attached tty but with
208 prefixes encoding the log level and "facility", see syslog(3), kmsg
209 (log to the kernel circular log buffer), journal (log to the
210 journal), journal-or-kmsg (log to the journal if available, and to
211 kmsg otherwise), auto (determine the appropriate log target
212 automatically, the default), null (disable log output).
213
214 $SYSTEMD_LOG_RATELIMIT_KMSG
215 Whether to ratelimit kmsg or not. Takes a boolean. Defaults to
216 "true". If disabled, systemd will not ratelimit messages written to
217 kmsg.
218
219 $SYSTEMD_PAGER
220 Pager to use when --no-pager is not given; overrides $PAGER. If
221 neither $SYSTEMD_PAGER nor $PAGER are set, a set of well-known
222 pager implementations are tried in turn, including less(1) and
223 more(1), until one is found. If no pager implementation is
224 discovered no pager is invoked. Setting this environment variable
225 to an empty string or the value "cat" is equivalent to passing
226 --no-pager.
227
228 Note: if $SYSTEMD_PAGERSECURE is not set, $SYSTEMD_PAGER (as well
229 as $PAGER) will be silently ignored.
230
231 $SYSTEMD_LESS
232 Override the options passed to less (by default "FRSXMK").
233
234 Users might want to change two options in particular:
235
236 K
237 This option instructs the pager to exit immediately when Ctrl+C
238 is pressed. To allow less to handle Ctrl+C itself to switch
239 back to the pager command prompt, unset this option.
240
241 If the value of $SYSTEMD_LESS does not include "K", and the
242 pager that is invoked is less, Ctrl+C will be ignored by the
243 executable, and needs to be handled by the pager.
244
245 X
246 This option instructs the pager to not send termcap
247 initialization and deinitialization strings to the terminal. It
248 is set by default to allow command output to remain visible in
249 the terminal even after the pager exits. Nevertheless, this
250 prevents some pager functionality from working, in particular
251 paged output cannot be scrolled with the mouse.
252
253 See less(1) for more discussion.
254
255 $SYSTEMD_LESSCHARSET
256 Override the charset passed to less (by default "utf-8", if the
257 invoking terminal is determined to be UTF-8 compatible).
258
259 $SYSTEMD_PAGERSECURE
260 Takes a boolean argument. When true, the "secure" mode of the pager
261 is enabled; if false, disabled. If $SYSTEMD_PAGERSECURE is not set
262 at all, secure mode is enabled if the effective UID is not the same
263 as the owner of the login session, see geteuid(2) and
264 sd_pid_get_owner_uid(3). In secure mode, LESSSECURE=1 will be set
265 when invoking the pager, and the pager shall disable commands that
266 open or create new files or start new subprocesses. When
267 $SYSTEMD_PAGERSECURE is not set at all, pagers which are not known
268 to implement secure mode will not be used. (Currently only less(1)
269 implements secure mode.)
270
271 Note: when commands are invoked with elevated privileges, for
272 example under sudo(8) or pkexec(1), care must be taken to ensure
273 that unintended interactive features are not enabled. "Secure" mode
274 for the pager may be enabled automatically as describe above.
275 Setting SYSTEMD_PAGERSECURE=0 or not removing it from the inherited
276 environment allows the user to invoke arbitrary commands. Note that
277 if the $SYSTEMD_PAGER or $PAGER variables are to be honoured,
278 $SYSTEMD_PAGERSECURE must be set too. It might be reasonable to
279 completely disable the pager using --no-pager instead.
280
281 $SYSTEMD_COLORS
282 Takes a boolean argument. When true, systemd and related utilities
283 will use colors in their output, otherwise the output will be
284 monochrome. Additionally, the variable can take one of the
285 following special values: "16", "256" to restrict the use of colors
286 to the base 16 or 256 ANSI colors, respectively. This can be
287 specified to override the automatic decision based on $TERM and
288 what the console is connected to.
289
290 $SYSTEMD_URLIFY
291 The value must be a boolean. Controls whether clickable links
292 should be generated in the output for terminal emulators supporting
293 this. This can be specified to override the decision that systemd
294 makes based on $TERM and other conditions.
295
297 Show current settings:
298
299 $ timedatectl
300 Local time: Thu 2017-09-21 16:08:56 CEST
301 Universal time: Thu 2017-09-21 14:08:56 UTC
302 RTC time: Thu 2017-09-21 14:08:56
303 Time zone: Europe/Warsaw (CEST, +0200)
304 System clock synchronized: yes
305 NTP service: active
306 RTC in local TZ: no
307
308 Enable network time synchronization:
309
310 $ timedatectl set-ntp true
311 ==== AUTHENTICATING FOR org.freedesktop.timedate1.set-ntp ===
312 Authentication is required to control whether network time synchronization shall be enabled.
313 Authenticating as: user
314 Password: ********
315 ==== AUTHENTICATION COMPLETE ===
316
317
318
319 $ systemctl status systemd-timesyncd.service
320 ● systemd-timesyncd.service - Network Time Synchronization
321 Loaded: loaded (/usr/lib/systemd/system/systemd-timesyncd.service; enabled)
322 Active: active (running) since Mo 2015-03-30 14:20:38 CEST; 5s ago
323 Docs: man:systemd-timesyncd.service(8)
324 Main PID: 595 (systemd-timesyn)
325 Status: "Using Time Server 216.239.38.15:123 (time4.google.com)."
326 CGroup: /system.slice/systemd-timesyncd.service
327 └─595 /usr/lib/systemd/systemd-timesyncd
328 ...
329
330 Show current status of systemd-timesyncd.service(8):
331
332 $ timedatectl timesync-status
333 Server: 216.239.38.15 (time4.google.com)
334 Poll interval: 1min 4s (min: 32s; max 34min 8s)
335 Leap: normal
336 Version: 4
337 Stratum: 1
338 Reference: GPS
339 Precision: 1us (-20)
340 Root distance: 335us (max: 5s)
341 Offset: +316us
342 Delay: 349us
343 Jitter: 0
344 Packet count: 1
345 Frequency: -8.802ppm
346
347
349 systemd(1), hwclock(8), date(1), localtime(5), systemctl(1), systemd-
350 timedated.service(8), systemd-timesyncd.service(8), systemd-
351 firstboot(1)
352
353
354
355systemd 254 TIMEDATECTL(1)