timedatectl command is used to set or query the system time, date, and time zone configuration in Linux. It is a part of the
systemd suite of system management tools and is available on most modern Linux distributions.
To view the current time and date settings, simply run the
timedatectl command with no arguments:
$ timedatectl Local time: Fri 2021-07-23 15:50:27 UTC Universal time: Fri 2021-07-23 15:50:27 UTC RTC time: Fri 2021-07-23 15:50:27 Time zone: Etc/UTC (UTC, +0000) NTP enabled: yes NTP synchronized: yes RTC in local TZ: no DST active: n/a
The output shows the local time, universal time, RTC (real-time clock) time, time zone, and NTP (Network Time Protocol) status.
To set the system time and date, use the
set-date options, respectively:
$ sudo timedatectl set-time "2021-07-23 15:55:00" $ sudo timedatectl set-date "2021-07-23"
To set the time zone, use the
set-timezone option followed by the name of the time zone:
$ sudo timedatectl set-timezone America/New_York
You can also list all available time zones by running:
$ timedatectl list-timezones
The following options are available for the
||Show the current time and date settings.|
||Set the system time. The
||Set the system time zone. The
||Set whether the RTC is in local time. The
||List all available time zones.|
||Show help information.|
- If you receive an error message when trying to set the time or date, make sure you have sufficient privileges to do so. Running the command with
sudoshould resolve this issue.
- If the system clock is consistently incorrect, ensure that the NTP service is enabled and running. You can check the status of the NTP service by running
- Changes made with
timedatectlare persistent across reboots.
timedatectlcommand requires the
systemdsystem and service manager to be installed on the system.