timedatectl
Control system time and date
TLDR
Check the current system clock time
Set the local time of the system clock directly
List available timezones
Set the system timezone
Enable Network Time Protocol (NTP) synchronization
Change the hardware clock time standard to localtime
SYNOPSIS
timedatectl [OPTIONS...] {COMMAND} [ARGUMENTS...]
Common Commands:
timedatectl status
timedatectl set-time 'YYYY-MM-DD HH:MM:SS'
timedatectl set-timezone TIMEZONE
timedatectl list-timezones
timedatectl set-ntp [true|false]
timedatectl set-local-rtc [true|false] [--adjust-system-clock]
PARAMETERS
status
Displays the current system time, date, timezone, NTP synchronization status, and RTC information.
set-time 'YYYY-MM-DD HH:MM:SS'
Sets the system's date and time. The format must be a valid timestamp string like '2023-10-27 15:30:00'.
set-timezone TIMEZONE
Sets the system's timezone. Use list-timezones to find valid timezone names (e.g., 'America/New_York').
list-timezones
Lists all known timezones available on the system.
set-ntp [true|false]
Enables or disables NTP (Network Time Protocol) synchronization. 'true' enables, 'false' disables.
set-local-rtc [true|false]
Configures whether the RTC (Real Time Clock) is kept in local time ('true') or Coordinated Universal Time (UTC) ('false'). Default is UTC.
--adjust-system-clock
(Used with set-local-rtc) Immediately adjusts the system clock to match the new RTC setting when changing the RTC mode.
show
Shows properties of the time and date settings in a machine-readable format.
-h, --help
Displays a help message and exits.
DESCRIPTION
timedatectl is a command-line utility part of the systemd suite, designed to query and change the system clock and its settings. It provides a modern, unified interface for managing time configurations on Linux distributions that use systemd. This includes setting the system's current time and date, configuring the timezone, enabling or disabling Network Time Protocol (NTP) synchronization, and managing the Real Time Clock (RTC) settings.
It replaces or integrates functionalities previously handled by disparate tools like hwclock and date, offering a more streamlined approach. timedatectl distinguishes between the system clock (a software clock maintained by the kernel) and the hardware clock (RTC) and facilitates their synchronization. Most modifications to time and date settings require superuser privileges.
CAVEATS
- Most timedatectl commands that modify system settings (e.g., set-time, set-timezone) require root privileges to execute successfully.
- Manually setting the time (set-time) while NTP synchronization is active can cause conflicts, as NTP will continuously attempt to correct the clock. It's generally advised to disable NTP or let NTP manage time entirely.
- Incorrectly configuring set-local-rtc (e.g., setting RTC to local time when the OS expects UTC) can lead to time discrepancies, especially in dual-boot environments with operating systems like Windows that often assume local RTC.
HISTORY
timedatectl emerged as a core utility within the systemd project, which began development in 2010. Its inclusion signified a shift towards a more integrated and unified approach to system management in modern Linux distributions. As systemd progressively replaced older init systems like SysVinit, timedatectl became the standard command for time and date configuration on systems running systemd, such as Fedora, CentOS/RHEL 7+, and Ubuntu 15.04+.