timedatectl Command in Linux: Time, Date & Timezones Guide
Learn timedatectl command in linux with syntax, essential flags, practical terminal examples, real-world sysadmin workflows, security tips, and troubleshooting.
10 min read
Learn timedatectl command in linux with syntax, essential flags, practical terminal examples, real-world sysadmin workflows, security tips, and troubleshooting.
- What timedatectl Does and When to Use It
- Availability and Installation Across Linux Distributions
- Command Syntax, Arguments, and Exit Status Codes
Interactive Builder for this Guide
Build your custom systemd syntax (timedatectl Command in Linux: Time, Date & Timezones Guide)
[Unit] Description=Core API Node Service After=network-online.target Wants=network-online.target [Service] Type=simple User=www-data WorkingDirectory=/opt/myapp EnvironmentFile=/opt/myapp/.env ExecStart=/usr/bin/node dist/server.js Restart=on-failure RestartSec=5 NoNewPrivileges=true [Install] WantedBy=multi-user.target
After=network-online.targetWaits until host networking is online before launchingUser=www-dataRuns process with least privilege instead of rootRestart=on-failureAutomatically recovers process after crashes (delay 5s)NoNewPrivileges=trueSecurity hardening preventing child privilege escalationPrecise system time synchronization is foundational to modern computing, and the timedatectl command in linux serves as the standard, unified interface for inspecting and configuring system clocks, timezone locations, hardware RTCs, and network time synchronization across systemd-based Linux distributions. Replacing legacy date, hwclock, and manual /etc/localtime symlink manipulation, timedatectl communicates directly with the systemd time management daemon.
The timedatectl command in Linux is a systemd utility used to query and alter the system clock, hardware Real-Time Clock (RTC), system timezone, and Network Time Protocol (NTP) synchronization settings. Run timedatectl status to view current time and synchronization details, or sudo timedatectl set-timezone Europe/London to update the system timezone.
In distributed systems, microservices architectures, and database clusters, clock drift of just a few milliseconds can disrupt database transactions, invalidate cryptographic authentication tokens (such as Kerberos tickets, OAuth2 JWTs, and SSL/TLS certificates), and cause distributed consensus protocols (Raft, Paxos) to split-brain. Having a reliable, scriptable tool to query time synchronization status and enforce timezone consistency across servers is crucial for operational reliability.
In this guide, we explore the dual clock architecture (system clock versus hardware RTC), examine D-Bus systemd communication mechanics, review the complete timedatectl command suite, walk through practical administration examples, and configure automated NTP time synchronization.
What timedatectl Does and When to Use It
Linux maintains two distinct clocks: the System Clock (also known as the software clock, managed by the kernel using CPU timer interrupts and tracking Coordinated Universal Time since the Unix epoch) and the Hardware Clock (the Real-Time Clock or RTC, a battery-backed integrated circuit on the motherboard that preserves time across system power-offs). During boot, the Linux kernel initializes the system clock from the RTC; thereafter, the system clock runs independently in memory.
When you run timedatectl, the client connects over the D-Bus system bus to the org.freedesktop.timedate1 service managed by systemd. To set timezones, timedatectl updates the /etc/localtime symbolic link to point to a binary timezone file inside /usr/share/zoneinfo/ (for example, /usr/share/zoneinfo/UTC) and updates /etc/timezone. When network time synchronization is enabled, timedatectl signals systemd-timesyncd (or active third-party NTP daemons like chrony or ntpd) to continuously discipline the kernel clock frequency using adjtimex(2) system calls.
Under the hood, timedatectl gathers runtime telemetry or dispatches control signals by reading virtual filesystems mounted at /proc and /sys, or by communicating with PID 1 (systemd) over D-Bus. Using flags such as --no-ask-password, --adjust-system-clock, -H <host>, -M <container> turns raw process and service tables into actionable diagnostics during incident response.
Availability and Installation Across Linux Distributions
The timedatectl utility is packaged in systemd across mainstream Linux distributions. It is pre-installed on standard Ubuntu, Debian, RHEL, Rocky Linux, AlmaLinux, Fedora, and Arch Linux systems, while minimal container images may require manual installation:
Before running administrative tasks or automation scripts, verify whether timedatectl is installed and inspect which binary path and version your shell resolves:
type -a timedatectl
timedatectl --version 2>/dev/null || man -f timedatectl
# Illustrative output (reviewed against documentation)
timedatectl is /usr/bin/timedatectl
timedatectl (systemd)
# Debian / Ubuntu
sudo apt-get update && sudo apt-get install -y systemd
# RHEL / Rocky / AlmaLinux / Fedora
sudo dnf install -y systemd
# Arch Linux
sudo pacman -S --noconfirm systemd
# Alpine Linux
sudo apk add --no-cache systemd
Command Syntax, Arguments, and Exit Status Codes
timedatectl [OPTIONS...] {COMMAND}
The syntax follows the structure timedatectl [OPTIONS...] {COMMAND}. Running timedatectl with no arguments or passing status queries the current configuration, displaying Local time, Universal time (UTC), RTC time, the active Time zone, and boolean flags for System clock synchronized, NTP service, and RTC in local TZ. Modifying settings requires administrative privileges (prefixed with sudo).
Subcommands fall into three main groups: timezone management (set-timezone, list-timezones), manual clock adjustment (set-time), and synchronization control (set-ntp, set-local-rtc, timesync-status). Options include --no-ask-password (preventing interactive polkit password prompts in automated scripts), -H to execute queries over SSH against remote hosts, and --adjust-system-clock.
0— Command executed successfully and requested time or timezone was configured.1— Operational failure, such as invalid timezone name or NTP daemon unavailable.2— Malformed subcommand or unrecognized command-line flag.130— Process interrupted by user signal (SIGINT, Ctrl+C).
Important Options and Flags Reference
| Option / Flag | Long Form / Argument | Technical Behavior and Purpose |
|---|---|---|
--no-ask-password | --no-ask-password | Do not query the user for authentication password on terminal when using Polkit. |
--adjust-system-clock | --adjust-system-clock | When set-local-rtc is invoked, immediately adjusts system clock from the RTC. |
-H <host> | --host=<host> | Executes the time management operation on a remote host over SSH. |
-M <container> | --machine=<container> | Executes operation on a local container managed by systemd-machined. |
--all | --all | Shows all properties when querying service status. |
--value | --value | When showing properties, only prints values without property keys (useful in scripts). |
-p <prop> | --property=<prop> | Queries specific internal D-Bus properties from org.freedesktop.timedate1. |
--no-pager | --no-pager | Pipes output directly to standard output without invoking a pager like less. |
-h | --help | Displays a summary of usage syntax and subcommands. |
In automation scripts, passing --no-ask-password and --no-pager ensures that unattended Ansible playbooks, shell scripts, or cloud-init bootstrap scripts fail immediately if permissions are insufficient rather than blocking indefinitely at an interactive password prompt.
Using timedatectl show -p Timezone --value provides a clean, single-line output of the active timezone identifier (such as 'Etc/UTC'), making it much cleaner to ingest in shell variables than parsing raw text output with awk.
When combining short flags on the command line, POSIX and GNU utilities allow clustering boolean flags behind a single hyphen, provided any option taking an argument appears last. In automated shell scripts, using long-form GNU options where portable makes self-documenting code that is easier to audit during peer review.
Practical Basic and Advanced Usage Examples
1. Display Current System Time, RTC, and Timezone Status
Inspect the complete time configuration, including UTC, local time, timezone, and NTP synchronization state.
timedatectl status
# Illustrative output (reviewed against documentation)
Local time: Fri 2026-10-23 01:25:00 UTC
Universal time: Fri 2026-10-23 01:25:00 UTC
RTC time: Fri 2026-10-23 01:25:00
Time zone: Etc/UTC (UTC, +0000)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
The output confirms the system clock is synchronized with NTP, the RTC stores UTC time, and the current timezone is Etc/UTC.
2. List and Filter Available Timezones
Browse the standardized IANA timezone database and filter for specific regions using grep.
timedatectl list-timezones | grep -i "America/New"
# Illustrative output (reviewed against documentation)
America/New_York
The list-timezones command enumerates all supported zoneinfo identifiers available for use with set-timezone.
3. Change System Timezone Immediately
Update the server timezone to Europe/London without restarting the operating system.
sudo timedatectl set-timezone Europe/London && timedatectl | grep "Time zone"
# Illustrative output (reviewed against documentation)
Time zone: Europe/London (BST, +0100)
This command updates the /etc/localtime symlink immediately, affecting all new processes and log timestamps across the system.
4. Enable Network Time Protocol (NTP) Synchronization
Instruct systemd to activate the network time synchronization service (systemd-timesyncd or chrony).
sudo timedatectl set-ntp true && timedatectl timesync-status
# Illustrative output (reviewed against documentation)
Server: 185.125.190.56 (ntp.ubuntu.com)
Poll interval: 17min 4s (min: 32s; max 34min 8s)
Leap: normal
Version: 4
Stratum: 2
Reference: C0A80001
Precision: 1us (-24)
Root distance: 24.120ms (max: 5s)
Offset: +142us
Delay: 12.450ms
Jitter: 35us
The set-ntp true command activates the NTP client daemon, and timesync-status provides detailed telemetry including stratum, offset, and jitter.
5. Manually Set System Date and Time
Set the system time manually when operating on an isolated network without NTP access.
sudo timedatectl set-ntp false
sudo timedatectl set-time "2026-10-23 14:30:00"
# Illustrative output (reviewed against documentation)
# System time updated to 2026-10-23 14:30:00
NTP synchronization must be disabled first (set-ntp false) before timedatectl permits manual time assignment with set-time.
6. Configure Hardware Clock to Maintain UTC
Ensure the hardware RTC stores UTC time, adhering to Linux best practices.
sudo timedatectl set-local-rtc 0
# Illustrative output (reviewed against documentation)
# RTC in local TZ: no
Setting local-rtc to 0 keeps the hardware clock in UTC, avoiding timezone shifts and daylight saving time synchronization bugs.
Real-World Workflows, Pipelines, and Shell Automation
Cloud Instance Provisioning Workflow: Standardizing UTC and Verifying NTP
Automate timezone standardization and NTP client configuration across newly launched cloud server instances.
#!/usr/bin/env bash
set -euo pipefail
echo "[TIME] Setting timezone to UTC..."
sudo timedatectl set-timezone Etc/UTC
echo "[TIME] Enabling systemd network time synchronization..."
sudo timedatectl set-ntp true
# Validate synchronization status
SYNCED=$(timedatectl show -p NTPSynchronized --value)
if [ "$SYNCED" = "yes" ]; then
echo "[SUCCESS] Time synchronized with NTP authority."
else
echo "[INFO] NTP daemon active, acquiring lock..."
fi
# Illustrative output (reviewed against documentation)
[TIME] Setting timezone to UTC...
[TIME] Enabling systemd network time synchronization...
[SUCCESS] Time synchronized with NTP authority.
Automating UTC enforcement across server fleets ensures centralized log aggregators (Elasticsearch, Loki) correlate distributed event timestamps accurately.
Diagnosing Clock Drift and Re-syncing RTC in Distributed Clusters
Investigate clock skew and synchronize the hardware RTC from an authoritative chrony NTP source.
sudo chronyc tracking
sudo timedatectl set-local-rtc 0 --adjust-system-clock
sudo hwclock --systohc
timedatectl status
# Illustrative output (reviewed against documentation)
Reference ID : 0A140001 (time.google.com)
Stratum : 1
Ref time (UTC) : Fri Oct 23 01:28:10 2026
System time : 0.000012402 seconds fast of NTP time
Last offset : +0.000008401 seconds
RMS offset : 0.000014210 seconds
Frequency : 12.412 ppm fast
Residual freq : +0.001 ppm
Skew : 0.021 ppm
Combining chronyc tracking with hwclock --systohc ensures the disciplined system time is mirrored into the motherboard RTC to prevent drift during reboots.
Pipelines, Redirection, Quoting, and Shell Expansion
When embedding timedatectl inside shell pipelines (|), conditional chains (&& and ||), or command substitutions ($(...)), the calling shell performs tilde expansion, variable interpolation, and globbing before invoking the binary. Always wrap paths, patterns, and variables in quotes so whitespace and wildcard characters (*, ?) are not expanded prematurely, and use set -euo pipefail in unattended scripts.
Permissions, Security Implications, and Safe Execution
Changing the system clock backward on production servers can corrupt database transaction timestamps, disrupt distributed consensus algorithms (such as Raft or etcd), invalidate SSL/TLS certificates, and cause cron jobs to trigger unexpectedly. Always use NTP time slewing rather than abruptly stepping system time on active production workloads.
Modifying system time and timezone parameters via timedatectl is secured by Polkit (org.freedesktop.timedate1.set-time and set-timezone actions). Unprivileged users can read the clock and list timezones, but changing the time requires root or an active desktop session with Polkit authorization. This prevents local non-root users from tampering with audit logs by manipulating timestamps.
From a network security perspective, clock desynchronization is a primary attack vector against security protocols. Kerberos tickets automatically reject authentication requests if client-server clock skew exceeds 300 seconds (5 minutes) to protect against replay attacks. Similarly, TLS certificate validity ranges (Not Before / Not After) will reject valid certificates if the local server clock is set incorrectly.
GNU/Linux, BSD, and BusyBox Implementation Differences
The timedatectl command is exclusive to systemd-based Linux systems (such as Ubuntu, Debian, Red Hat Enterprise Linux, Rocky Linux, Fedora, and Arch). On non-systemd Linux distributions (such as Alpine Linux with OpenRC, Void Linux with runit, or Gentoo), administrators manage time using date, hwclock, and by manually linking /etc/localtime to /usr/share/zoneinfo/.
On BSD systems and macOS, timezone is configured by modifying /etc/localtime directly or using syssetup / sntp, as systemd utilities are not available. In Docker containers sharing the host kernel, system time cannot be adjusted inside an unprivileged container; the container automatically inherits the host kernel's clock.
Troubleshooting Common Errors and Diagnostics
Failed to set time: Automatic time synchronization is enabled
Root Cause: You attempted to manually assign time using set-time while systemd-timesyncd or chrony is actively managing the clock.
Resolution: Disable NTP synchronization first before manually setting the time, or rely on NTP for accurate synchronization.
sudo timedatectl set-ntp false
sudo timedatectl set-time "2026-10-23 15:00:00"
Failed to set timezone: Invalid timezone 'US/Eastern'
Root Cause: The specified timezone string does not match any valid zoneinfo file in /usr/share/zoneinfo/.
Resolution: Use timedatectl list-timezones to find the exact case-sensitive IANA timezone identifier (e.g., America/New_York).
timedatectl list-timezones | grep -i "new_york"
sudo timedatectl set-timezone America/New_York
NTP service not active or timesync-status fails
Root Cause: No compatible NTP daemon (systemd-timesyncd, chrony, or ntpd) is installed or running on the system.
Resolution: Install and enable systemd-timesyncd or chrony using your package manager.
sudo apt-get install -y systemd-timesyncd
sudo systemctl enable --now systemd-timesyncd
sudo timedatectl set-ntp true
Alternatives, Related Commands, and Related Tutorials
- systemctl Command in Linux: Start, Stop, Enable, and Manage Services — Practical syntax, flags, and examples for
systemctl. - uptime Command in Linux: Check System Uptime and Load Average — Practical syntax, flags, and examples for
uptime. - How to Check Linux Version: Distro & Kernel Commands — Practical syntax, flags, and examples for
uname. - Linux ip Command: Networking Syntax, Flags & Practical Examples — Practical syntax, flags, and examples for
ip. - 25 Best Linux Commands Every Sysadmin Should Know — Core command-line utilities for daily Linux server administration.
- How to Find a File in Linux from the Command Line — Practical file search patterns across Linux directories.
- Linux Commands Knowledge Hub (#linux-commands) — Browse all Linux command-line tutorials and system administration references.
Authoritative References and Official Documentation

The Linux Command Line, 2nd Edition: A Complete Introduction
Frequently Asked Questions
Quick answers to common questions and configurations
/etc/localtime), but it cannot alter the system clock or control NTP daemons because containers share the host kernel's clock and lack CAP_SYS_TIME.Editorial Disclosure: Website Vidya is supported by our readers. When you purchase hosting, tools, or software through our verified partner links, we may earn an affiliate commission at no extra cost to you. We only recommend solutions we trust and rigorously verify.
Rajesh Ray
I’m Rajesh Rai, a full-stack developer, Linux administrator, and technology enthusiast passionate about making complex technology easier to understand and use.
Most Read Guides
TrendingUbuntu Server Not Booting? 10 Simple Steps to Fix It Fast
How to Create a 3D Button in HTML and CSS: Easy Steps
How to Install Python and Pip on Ubuntu 24.04 LTS
How to Install Nginx on Ubuntu 24.04
How to Install Python on Ubuntu 24.04 LTS
Related Technical Guides
Tested runbooks, server administration walkthroughs, and troubleshooting guides

Join the Conversation & Perspective
Have thoughts, counterpoints, or reflections on this story? Engage directly with fellow readers and editorial contributors.
No comments on this guide yet. Be the first to share your thoughts or ask a question!