The timedatectl command allows you to both query and change the system clock and its settings on Linux systems.
To display the current settings, use the command by itself—with no arguments. You should see something like this:
$ timedatectl Local time: Thu 2021-12-16 11:12:31 EST Universal time: Thu 2021-12-16 16:12:31 UTC RTC time: Thu 2021-12-16 16:12:31 <; real time clock Time zone: America/New_York (EST, -0500) System clock synchronized: yes NTP service: active RTC in local TZ: no
The fields shown include the local time, universal time (the same around the globe), RTC (the real-time clock, usually an integrated circuit), and the time zone (America/New York” is the Eastern time zone). NTP is network time protocol for clock synchronization between computer systems over packet-switched, variable-latency data networks. In this case, the RTC it is not set to the local time zone.
Time and date changes are seldom needed since your system generally manages this from the time of installation using NTP. If you move or take your laptop on vacation with you, however, you might want to make some changes to accommodate your new location.
To change your settings, you need to use sudo.
$ timedatectl set-timezone America/New_York <== no change, no authentication $ timedatectl set-timezone America/Nome ==== AUTHENTICATING FOR org.freedesktop.timedate1.set-timezone ==== Authentication is required to set the system timezone. Authenticating as: Sandra Henry-Stocker (shs) Password: ==== AUTHENTICATION COMPLETE ==== $ timedatectl Local time: Thu 2021-12-16 07:27:00 AKST Universal time: Thu 2021-12-16 16:27:00 UTC RTC time: Thu 2021-12-16 16:27:00 Time zone: America/Nome (AKST, -0900) System clock synchronized: yes NTP service: active RTC in local TZ: no
You can change the time zone using sudo, but not the date or the time if your system clock is synchronized.
If you want to list the time zones, you can use the list-timezones option. There are 339 of them, so I prefer passing the command’s output to the column command:
$ timedatectl list-timezones | wc -l 339 $ timedatectl list-timezones | column Africa/Abidjan America/Paramaribo Asia/Yekaterinburg Africa/Algiers America/Phoenix Asia/Yerevan Africa/Bissau America/Port-au-Prince Atlantic/Azores Africa/Cairo America/Porto_Velho Atlantic/Bermuda Africa/Casablanca America/Puerto_Rico Atlantic/Canary Africa/Ceuta America/Punta_Arenas Atlantic/Cape_Verde Africa/El_Aaiun America/Rainy_River Atlantic/Faroe Africa/Johannesburg America/Rankin_Inlet Atlantic/Madeira Africa/Juba America/Recife Atlantic/Reykjavik Africa/Khartoum America/Regina Atlantic/South_Georgia Africa/Lagos America/Resolute Atlantic/Stanley Africa/Maputo America/Rio_Branco Australia/Adelaide Africa/Monrovia America/Santarem Australia/Brisbane Africa/Nairobi America/Santiago Australia/Broken_Hill Africa/Ndjamena America/Santo_Domingo Australia/Darwin … … …
You can look into additional timedatectl command options by asking for help like this:
$ timedatectl -h command.
Copyright © 2021 IDG Communications, Inc.