Skip to content

Listing Linux TZ Environment Variable

Time zones can be confusing. If you want to see a list of time-zones you can use in the Perl $ENV{TZ} = ‘xxxx’ you can have a look at the Timezone files in /usr/share/zoneinfo

Here is a quick way to see the available timezones in Europe:

tail -n 1 /usr/share/zoneinfo/Europe/* | sed -r 's/,.+//'

This returns a bunch of stuff like this:

==> /usr/share/zoneinfo/Europe/Gibraltar < ==
CET-1CEST
==> /usr/share/zoneinfo/Europe/Guernsey < ==
GMT0BST
==> /usr/share/zoneinfo/Europe/Helsinki < ==
EET-2EEST

The line starting with ==> is the name of the file, and the following line the TZ code.

You can change ‘Europe’ to America, Australia, Africa etc. Have a look in /usr/share/zoneinfo to see all the available folders.

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*