timedatectl
Control system time and timezone
TLDR
Show current time and date settings
$ timedatectl
Set local time directlycopy
$ timedatectl set-time "2024年01月15日 14:30:00"
List available timezonescopy
$ timedatectl list-timezones
Set system timezonecopy
$ timedatectl set-timezone America/New_York
Enable NTP synchronizationcopy
$ timedatectl set-ntp on
Set hardware clock to local timecopy
$ timedatectl set-local-rtc 1
copy
SYNOPSIS
timedatectl [OPTIONS] [COMMAND]
DESCRIPTION
timedatectl queries and changes the system clock and its settings. It controls the system time, timezone, and network time synchronization through systemd-timedated.
PARAMETERS
--no-pager
Do not pipe output into a pager--no-ask-password
Do not prompt for password-H, --host
Execute operation on remote host-M, --machine
Execute operation on container-p, --property
Show specific property--value
Show only property values
COMMANDS
status
Show current time/date settings (default command)show
Show properties in machine-readable formatset-time TIME
Set system time (YYYY-MM-DD HH:MM:SS format)set-timezone ZONE
Set system timezonelist-timezones
List available timezonesset-local-rtc BOOL
Control RTC in local time (0=UTC, 1=local)set-ntp BOOL
Enable or disable NTP synchronizationtimesync-status
Show status of systemd-timesyncd
CAVEATS
Setting time manually (set-time) disables NTP synchronization. RTC in local time (set-local-rtc 1) can cause issues with dual-boot systems during DST changes.
HISTORY
timedatectl is part of systemd, introduced to provide a unified interface for time/date management replacing older tools like hwclock and tzselect.