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 below.
72
73 systemd-timesyncd Commands
74 The following commands are specific to systemd-timesyncd.service(8).
75
76 timesync-status
77 Show current status of systemd-timesyncd.service(8). If --monitor
78 is specified, then this will monitor the status updates.
79
80 show-timesync
81 Show the same information as timesync-status, but in machine
82 readable form. This command is intended to be used whenever
83 computer-parsable output is required. Use timesync-status if you
84 are looking for formatted human-readable output.
85
86 By default, empty properties are suppressed. Use --all to show
87 those too. To select specific properties to show, use --property=.
88
89 ntp-servers INTERFACE SERVER...
90 Set the interface specific NTP servers. This command can be used
91 only when the interface is managed by systemd-networkd.
92
93 revert INTERFACE
94 Revert the interface specific NTP servers. This command can be used
95 only when the interface is managed by systemd-networkd.
96
98 The following options are understood:
99
100 --no-ask-password
101 Do not query the user for authentication for privileged operations.
102
103 --adjust-system-clock
104 If set-local-rtc is invoked and this option is passed, the system
105 clock is synchronized from the RTC again, taking the new setting
106 into account. Otherwise, the RTC is synchronized from the system
107 clock.
108
109 --monitor
110 If timesync-status is invoked and this option is passed, then
111 timedatectl monitors the status of systemd-timesyncd.service(8) and
112 updates the outputs. Use Ctrl+C to terminate the monitoring.
113
114 -a, --all
115 When showing properties of systemd-timesyncd.service(8), show all
116 properties regardless of whether they are set or not.
117
118 -p, --property=
119 When showing properties of systemd-timesyncd.service(8), limit
120 display to certain properties as specified as argument. If not
121 specified, all set properties are shown. The argument should be a
122 property name, such as "ServerName". If specified more than once,
123 all properties with the specified names are shown.
124
125 --value
126 When printing properties with show-timesync, only print the value,
127 and skip the property name and "=".
128
129 -H, --host=
130 Execute the operation remotely. Specify a hostname, or a username
131 and hostname separated by "@", to connect to. The hostname may
132 optionally be suffixed by a port ssh is listening on, separated by
133 ":", and then a container name, separated by "/", which connects
134 directly to a specific container on the specified host. This will
135 use SSH to talk to the remote machine manager instance. Container
136 names may be enumerated with machinectl -H HOST. Put IPv6 addresses
137 in brackets.
138
139 -M, --machine=
140 Execute operation on a local container. Specify a container name to
141 connect to.
142
143 -h, --help
144 Print a short help text and exit.
145
146 --version
147 Print a short version string and exit.
148
149 --no-pager
150 Do not pipe output into a pager.
151
153 On success, 0 is returned, a non-zero failure code otherwise.
154
156 $SYSTEMD_PAGER
157 Pager to use when --no-pager is not given; overrides $PAGER. If
158 neither $SYSTEMD_PAGER nor $PAGER are set, a set of well-known
159 pager implementations are tried in turn, including less(1) and
160 more(1), until one is found. If no pager implementation is
161 discovered no pager is invoked. Setting this environment variable
162 to an empty string or the value "cat" is equivalent to passing
163 --no-pager.
164
165 $SYSTEMD_LESS
166 Override the options passed to less (by default "FRSXMK").
167
168 Users might want to change two options in particular:
169
170 K
171 This option instructs the pager to exit immediately when Ctrl+C
172 is pressed. To allow less to handle Ctrl+C itself to switch
173 back to the pager command prompt, unset this option.
174
175 If the value of $SYSTEMD_LESS does not include "K", and the
176 pager that is invoked is less, Ctrl+C will be ignored by the
177 executable, and needs to be handled by the pager.
178
179 X
180 This option instructs the pager to not send termcap
181 initialization and deinitialization strings to the terminal. It
182 is set by default to allow command output to remain visible in
183 the terminal even after the pager exits. Nevertheless, this
184 prevents some pager functionality from working, in particular
185 paged output cannot be scrolled with the mouse.
186
187 See less(1) for more discussion.
188
189 $SYSTEMD_LESSCHARSET
190 Override the charset passed to less (by default "utf-8", if the
191 invoking terminal is determined to be UTF-8 compatible).
192
193 $SYSTEMD_PAGERSECURE
194 Takes a boolean argument. When true, the "secure" mode of the pager
195 is enabled; if false, disabled. If $SYSTEMD_PAGERSECURE is not set
196 at all, secure mode is enabled if the effective UID is not the same
197 as the owner of the login session, see geteuid(2) and
198 sd_pid_get_owner_uid(3). In secure mode, LESSSECURE=1 will be set
199 when invoking the pager, and the pager shall disable commands that
200 open or create new files or start new subprocesses. When
201 $SYSTEMD_PAGERSECURE is not set at all, pagers which are not known
202 to implement secure mode will not be used. (Currently only less(1)
203 implements secure mode.)
204
205 Note: when commands are invoked with elevated privileges, for
206 example under sudo(8) or pkexec(1), care must be taken to ensure
207 that unintended interactive features are not enabled. "Secure" mode
208 for the pager may be enabled automatically as describe above.
209 Setting SYSTEMD_PAGERSECURE=0 or not removing it from the inherited
210 environment allows the user to invoke arbitrary commands. Note that
211 if the $SYSTEMD_PAGER or $PAGER variables are to be honoured,
212 $SYSTEMD_PAGERSECURE must be set too. It might be reasonable to
213 completly disable the pager using --no-pager instead.
214
215 $SYSTEMD_COLORS
216 The value must be a boolean. Controls whether colorized output
217 should be generated. This can be specified to override the decision
218 that systemd makes based on $TERM and what the console is connected
219 to.
220
221 $SYSTEMD_URLIFY
222 The value must be a boolean. Controls whether clickable links
223 should be generated in the output for terminal emulators supporting
224 this. This can be specified to override the decision that systemd
225 makes based on $TERM and other conditions.
226
228 Show current settings:
229
230 $ timedatectl
231 Local time: Thu 2017-09-21 16:08:56 CEST
232 Universal time: Thu 2017-09-21 14:08:56 UTC
233 RTC time: Thu 2017-09-21 14:08:56
234 Time zone: Europe/Warsaw (CEST, +0200)
235 System clock synchronized: yes
236 NTP service: active
237 RTC in local TZ: no
238
239 Enable network time synchronization:
240
241 $ timedatectl set-ntp true
242 ==== AUTHENTICATING FOR org.freedesktop.timedate1.set-ntp ===
243 Authentication is required to control whether network time synchronization shall be enabled.
244 Authenticating as: user
245 Password: ********
246 ==== AUTHENTICATION COMPLETE ===
247
248
249
250 $ systemctl status systemd-timesyncd.service
251 ● systemd-timesyncd.service - Network Time Synchronization
252 Loaded: loaded (/usr/lib/systemd/system/systemd-timesyncd.service; enabled)
253 Active: active (running) since Mo 2015-03-30 14:20:38 CEST; 5s ago
254 Docs: man:systemd-timesyncd.service(8)
255 Main PID: 595 (systemd-timesyn)
256 Status: "Using Time Server 216.239.38.15:123 (time4.google.com)."
257 CGroup: /system.slice/systemd-timesyncd.service
258 └─595 /usr/lib/systemd/systemd-timesyncd
259 ...
260
261 Show current status of systemd-timesyncd.service(8):
262
263 $ timedatectl timesync-status
264 Server: 216.239.38.15 (time4.google.com)
265 Poll interval: 1min 4s (min: 32s; max 34min 8s)
266 Leap: normal
267 Version: 4
268 Stratum: 1
269 Reference: GPS
270 Precision: 1us (-20)
271 Root distance: 335us (max: 5s)
272 Offset: +316us
273 Delay: 349us
274 Jitter: 0
275 Packet count: 1
276 Frequency: -8.802ppm
277
278
280 systemd(1), hwclock(8), date(1), localtime(5), systemctl(1), systemd-
281 timedated.service(8), systemd-timesyncd.service(8), systemd-
282 firstboot(1)
283
284
285
286systemd 246 TIMEDATECTL(1)