timedatectlsystemdtimedatectl1timedatectlControl the system time and datetimedatectlOPTIONSCOMMANDDescriptiontimedatectl may be used to query and change the system clock and its settings,
and enable or disable time synchronization services.Use
systemd-firstboot1
to initialize the system time zone for mounted (but not booted)
system images.timedatectl may be used to show the current status of time synchronization
services, for example
systemd-timesyncd.service8.
CommandsThe following commands are understood:statusShow current settings of the system clock and RTC, including whether network time
synchronization is active. If no command is specified, this is the implied default.
showShow the same information as , but in machine readable form.
This command is intended to be used whenever computer-parsable output is required.
Use if you are looking for formatted human-readable output.By default, empty properties are suppressed. Use to show those too.
To select specific properties to show, use .set-time [TIME]Set the system clock to the specified time.
This will also update the RTC time accordingly. The time may
be specified in the format "2012-10-30
18:17:16".set-timezone [TIMEZONE]Set the system time zone to the specified
value. Available timezones can be listed with
list-timezones. If the RTC is configured to
be in the local time, this will also update the RTC time. This
call will alter the /etc/localtime
symlink. See
localtime5
for more information.list-timezonesList available time zones, one per line.
Entries from the list can be set as the system timezone with
set-timezone.set-local-rtc [BOOL]Takes a boolean argument. If
0, the system is configured to maintain the
RTC in universal time. If 1, it will
maintain the RTC in local time instead. Note that maintaining
the RTC in the local timezone is not fully supported and will
create various problems with time zone changes and daylight
saving adjustments. If at all possible, keep the RTC in UTC
mode. Note that invoking this will also synchronize the RTC
from the system clock, unless
is passed (see above).
This command will change the 3rd line of
/etc/adjtime, as documented in
hwclock8.
set-ntp [BOOL]Takes a boolean argument. Controls whether network time synchronization is active and
enabled (if available). If the argument is true, this enables and starts the first existing network
synchronization service. If the argument is false, then this disables and stops the known network
synchronization services. The way that the list of services is built is described in
systemd-timedated.service8.
systemd-timesyncd CommandsThe following commands are specific to
systemd-timesyncd.service8.
timesync-statusShow current status of
systemd-timesyncd.service8.
If is specified, then this will monitor the status updates.show-timesyncShow the same information as , but in machine readable form.
This command is intended to be used whenever computer-parsable output is required.
Use if you are looking for formatted human-readable output.By default, empty properties are suppressed. Use to show those too.
To select specific properties to show, use .ntp-servers INTERFACESERVER…Set the interface specific NTP servers. This command can be used only when the
interface is managed by systemd-networkd.revert INTERFACERevert the interface specific NTP servers. This command can be used only when
the interface is managed by systemd-networkd.OptionsThe following options are understood:If set-local-rtc is invoked
and this option is passed, the system clock is synchronized
from the RTC again, taking the new setting into account.
Otherwise, the RTC is synchronized from the system
clock.If timesync-status is invoked and this option is passed, then
timedatectl monitors the status of
systemd-timesyncd.service8
and updates the outputs. Use CtrlC to terminate the
monitoring.When showing properties of
systemd-timesyncd.service8,
show all properties regardless of whether they are set or not.When showing properties of
systemd-timesyncd.service8,
limit display to certain properties as specified as argument. If not specified, all set properties are shown.
The argument should be a property name, such as ServerName. If specified more than once,
all properties with the specified names are shown.When printing properties with show-timesync, only print the value, and skip the
property name and =.Exit statusOn success, 0 is returned, a non-zero failure code otherwise.ExamplesShow current settings:
$ timedatectl
Local time: Thu 2017-09-21 16:08:56 CEST
Universal time: Thu 2017-09-21 14:08:56 UTC
RTC time: Thu 2017-09-21 14:08:56
Time zone: Europe/Warsaw (CEST, +0200)
System clock synchronized: yes
NTP service: active
RTC in local TZ: noEnable network time synchronization:
$ timedatectl set-ntp true
==== AUTHENTICATING FOR org.freedesktop.timedate1.set-ntp ===
Authentication is required to control whether network time synchronization shall be enabled.
Authenticating as: user
Password: ********
==== AUTHENTICATION COMPLETE ===$ systemctl status systemd-timesyncd.service
● systemd-timesyncd.service - Network Time Synchronization
Loaded: loaded (/usr/lib/systemd/system/systemd-timesyncd.service; enabled)
Active: active (running) since Mo 2015-03-30 14:20:38 CEST; 5s ago
Docs: man:systemd-timesyncd.service(8)
Main PID: 595 (systemd-timesyn)
Status: "Using Time Server 216.239.38.15:123 (time4.google.com)."
CGroup: /system.slice/systemd-timesyncd.service
└─595 /usr/lib/systemd/systemd-timesyncd
…Show current status of
systemd-timesyncd.service8:
$ timedatectl timesync-status
Server: 216.239.38.15 (time4.google.com)
Poll interval: 1min 4s (min: 32s; max 34min 8s)
Leap: normal
Version: 4
Stratum: 1
Reference: GPS
Precision: 1us (-20)
Root distance: 335us (max: 5s)
Offset: +316us
Delay: 349us
Jitter: 0
Packet count: 1
Frequency: -8.802ppmSee Alsosystemd1hwclock8date1localtime5systemctl1systemd-timedated.service8systemd-timesyncd.service8systemd-firstboot1