Managing System Date, Time, and Timezone with timedatectl in Linux

Overview

The timedatectl command is a modern utility available in RHEL/CentOS 7 and Fedora 21+ systems. It serves as part of the systemd system and service manager, replacing the traditional date command used in sysvinit-based Linux distributions.

This command allows you to query and modify the system clock, configure time settings, set timezones, and enable automatic synchronization with remote NTP servers. Maintaining accurate time on your Linux servers offers several benefits:

  • Ensures time-sensitive system operations execute correctly
  • Provides accurate timestamps for logs and system events
  • Maintains consistency across distributed systems and services

Checking Current System Configuration

To display the current time, date, and timezone information:

timedatectl status

Sample output:

[user@linuxhost ~]$ timedatectl
               Local time: Wed 2024-01-15 14:32:17 PST
           Universal time: Wed 2024-01-15 22:32:17 UTC
             RTC time: Wed 2024-01-15 22:32:16
            Time zone: America/Los_Angeles (PST, -0800)
          NTP enabled: yes
      NTP synchronized: yes
       RTC in local TZ: no
            DST active: no

To display only the timezone information:

timedatectl | grep "Time zone"

Finding and Setting Timezone

To list all available timezone options:

timedatectl list-timezones

To search for a specific city's timezone:

timedatectl list-timezones | grep -i london
timedatectl list-timezones | grep -i sydney

Output:

[user@linuxhost ~]$ timedatectl list-timezones | grep London
Europe/London
user@linuxhost ~]$ timedatectl list-timezones | grep Sydney
Australia/Sydney

To set the system timezone:

sudo timedatectl set-timezone "America/New_York"
sudo timedatectl set-timezone "Europe/Paris"

For UTC (Coordinated Universal Time), use:

sudo timedatectl set-timezone UTC

Note: Ensure the timezone identifier is spelled correctly. Invalid timezone names will result in errors.

Setting Date and Time

To set the time only (using HH:MM:SS format):

sudo timedatectl set-time 09:45:30

To set the date only (using YYYY-MM-DD format):

sudo timedatectl set-time 2024-03-25

To set both date and time simultaneously:

sudo timedatectl set-time '09:45:30 2024-03-25'

Configuring Hardware Clock

The hardware clock (RTC - Real Time Clock) can be configured to use either local time or UTC. To check the current hardware clock setting:

timedatectl | grep "RTC in local"

To configure the hardware clock to use local timezone:

sudo timedatectl set-local-rtc 1

To configure the hardware clock to use UTC:

sudo timedatectl set-local-rtc 0

Recommendation: Using UTC for the hardware clock is generally preferred, especially on systems running multiple operating systems.

Enabling NTP Synchronization

NTP (Network Time Protocol) synchronizes your system clock with remote time servers. To enable automatic time synchronization:

sudo timedatectl set-ntp true

To disable NTP synchronization:

sudo timedatectl set-ntp false

Prerequisite: Ensure that the NTP service (such as chronyd or ntpd) is installed and enabled on your system for automatic time synchronization to function properly.

Practical Examples

Common timezone configurations:

# Set to US Eastern Time
sudo timedatectl set-timezone "America/New_York"

# Set to Central European Time
sudo timedatectl set-timezone "Europe/Berlin"

# Set to Asia/Tokyo
sudo timedatectl set-timezone "Asia/Tokyo"

# Enable NTP sync
sudo timedatectl set-ntp true

# Verify settings
timedatectl status

Tags: Linux systemd timedatectl timezone NTP

Posted on Wed, 16 Sep 2026 16:03:00 +0000 by whiteboikyle