15

I would like to have a list of all the timezones in my system's zoneinfo database (note : system is a debian strecth linux)

The current solution I have is : list all paths under /usr/share/zoneinfo/posix, which are either plain files or symlinks

cd /usr/share/zoneinfo/posix && find * -type f -or -type l | sort

I am not sure, however, that each and every known timezone is mapped to a path under this directory.

Question

Is there a command which gives the complete list of timezones in the system's current zoneinfo database ?

1
  • Crossposting is not allowed on the SE network. Please delete the other question.
    – Sven
    Feb 18, 2019 at 11:09

2 Answers 2

16

On Debian 9, your command gave me all of the timezones listed here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

Additionally, systemd provides timedatectl list-timezones, which outputs a list identical to your command.

As far as I know, the data in tzdata is provided directly from IANA:

This package contains data required for the implementation of
 standard local time for many representative locations around the
 globe. It is updated periodically to reflect changes made by
 political bodies to time zone boundaries, UTC offsets, and
 daylight-saving rules.

So just keep the tzdata package updated.

2
  • 1
    Yes, nowadays IANA is the canonical distribution point for the tz database.
    – fpmurphy
    Mar 3, 2019 at 5:14
  • 1
    Would LOVE to use this for a script....Lacks compatibility with WSL unfortunately because it depends on systemd. Guess I figured you could grep out the timezone list from tzdata. Wonder why something so simple is not available.
    – Lon Kaut
    Aug 26, 2020 at 14:24
2

If you want to retrieve the list on a system which does not use systemd here is an awk script which I have derived from the implementation of timedatectl list-timezones:

awk '/^Z/ { print $2 }; /^L/ { print $3 }' /usr/share/zoneinfo/tzdata.zi

Pipe its output into sort and you get almost the identical result as timedatectl list-timezones.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.