table of contents
- bookworm 252.36-1~deb12u1
- bookworm-backports 254.26-1~bpo12+1
- testing 257.5-2
- unstable 257.6-1
TIMEDATECTL(1) | timedatectl | TIMEDATECTL(1) |
NAME¶
timedatectl - Control the system time and date
SYNOPSIS¶
timedatectl [OPTIONS...] {COMMAND}
DESCRIPTION¶
timedatectl may be used to query and change the system clock and its settings, and enable or disable time synchronization services.
Use systemd-firstboot(1) 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.service(8).
COMMANDS¶
The following commands are understood:
status
show
By default, empty properties are suppressed. Use --all to show those too. To select specific properties to show, use --property=.
set-time [TIME]
set-timezone [TIMEZONE]
list-timezones
set-local-rtc [BOOL]
set-ntp [BOOL]
systemd-timesyncd Commands¶
The following commands are specific to systemd-timesyncd.service(8).
timesync-status
show-timesync
By default, empty properties are suppressed. Use --all to show those too. To select specific properties to show, use --property=.
ntp-servers INTERFACE SERVER...
revert INTERFACE
OPTIONS¶
The following options are understood:
--no-ask-password
--adjust-system-clock
--monitor
-a, --all
-p, --property=
--value
-H, --host=
-M, --machine=
-h, --help
--version
--no-pager
EXIT STATUS¶
On success, 0 is returned, a non-zero failure code otherwise.
ENVIRONMENT¶
$SYSTEMD_LOG_LEVEL
$SYSTEMD_LOG_COLOR
This setting is only useful when messages are written directly to the terminal, because journalctl(1) and other tools that display logs will color messages based on the log level on their own.
$SYSTEMD_LOG_TIME
This setting is only useful when messages are written directly to the terminal or a file, because journalctl(1) and other tools that display logs will attach timestamps based on the entry metadata on their own.
$SYSTEMD_LOG_LOCATION
Note that the log location is often attached as metadata to journal entries anyway. Including it directly in the message text can nevertheless be convenient when debugging programs.
$SYSTEMD_LOG_TID
Note that the this information is attached as metadata to journal entries anyway. Including it directly in the message text can nevertheless be convenient when debugging programs.
$SYSTEMD_LOG_TARGET
$SYSTEMD_LOG_RATELIMIT_KMSG
$SYSTEMD_PAGER, $PAGER
Note: if $SYSTEMD_PAGERSECURE is not set, $SYSTEMD_PAGER and $PAGER can only be used to disable the pager (with "cat" or ""), and are otherwise ignored.
$SYSTEMD_LESS
Users might want to change two options in particular:
K
If the value of $SYSTEMD_LESS does not include "K", and the pager that is invoked is less, Ctrl+C will be ignored by the executable, and needs to be handled by the pager.
X
Note that setting the regular $LESS environment variable has no effect for less invocations by systemd tools.
See less(1) for more discussion.
$SYSTEMD_LESSCHARSET
Note that setting the regular $LESSCHARSET environment variable has no effect for less invocations by systemd tools.
$SYSTEMD_PAGERSECURE
This option takes a boolean argument. When set to true, the "secure mode" of the pager is enabled. In "secure mode", LESSSECURE=1 will be set when invoking the pager, which instructs the pager to disable commands that open or create new files or start new subprocesses. Currently only less(1) is known to understand this variable and implement "secure mode".
When set to false, no limitation is placed on the pager. Setting SYSTEMD_PAGERSECURE=0 or not removing it from the inherited environment may allow the user to invoke arbitrary commands.
When $SYSTEMD_PAGERSECURE is not set, systemd tools attempt to automatically figure out if "secure mode" should be enabled and whether the pager supports it. "Secure mode" is enabled if the effective UID is not the same as the owner of the login session, see geteuid(2) and sd_pid_get_owner_uid(3), or when running under sudo(8) or similar tools ($SUDO_UID is set [1]). In those cases, SYSTEMD_PAGERSECURE=1 will be set and pagers which are not known to implement "secure mode" will not be used at all. Note that this autodetection only covers the most common mechanisms to elevate privileges and is intended as convenience. It is recommended to explicitly set $SYSTEMD_PAGERSECURE or disable the pager.
Note that if the $SYSTEMD_PAGER or $PAGER variables are to be honoured, other than to disable the pager, $SYSTEMD_PAGERSECURE must be set too.
$SYSTEMD_COLORS
$SYSTEMD_URLIFY
EXAMPLES¶
Show 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: no
Enable 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 (/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 /lib/systemd/systemd-timesyncd ...
Show current status of systemd-timesyncd.service(8):
$ 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.802ppm
SEE ALSO¶
systemd(1), hwclock(8), date(1), localtime(5), systemctl(1), systemd-timedated.service(8), systemd-timesyncd.service(8), systemd-firstboot(1)
NOTES¶
- 1.
- It is recommended for other tools to set and check $SUDO_UID as appropriate, treating it is a common interface.
systemd 254 |