Linux zdump Command Tutorial for Beginners (with Examples)

With team members working from different countries nowadays, it sometimes becomes important to be aware of the timezone information for different locations. In general also, there may be situations wherein you may want to quickly see timezone for a particular location. You’ll be glad to know there’s a command line utility – dubbed zdump – that lets you do this.

In this tutorial, we will discuss the basics of zdump using some easy to understand examples. But before we do that, it’s worth mentioning that all examples mentioned in this article have been tested on an Ubuntu 18.04 LTS machine.

Linux zdump command

The zdump command in Linux is basically a timezone dumping tool. Following is its syntax:

zdump [–version] [–help] [-v] [-c [loyear,]hiyear] [zonename…]

And here’s how the man page explains it:

The zdump program prints the current time in each zonename named on the command line.

Following are some examples that should give you a good idea on how the zdump command works.

Q1. How to use zdump command?

Basic usage is fairly simple. Just execute ‘zdump’ with the location name as input. For example:

zdump Singapore

Following is the output the command produced on my system:

Singapore  Wed Oct 31 17:35:39 2018 +08

Here are some other examples:

How to use zdump command

It’s worth mentioning here that you can zdump to fetch city specific information. Following are some examples:

Use zdump to fetch city specific information

Q2. How to make zdump produce detailed information in output?

In case you want zdump to produce detailed information, use the -v command line option. For example, the following command:

zdump -v Singapore

produced this output:

Singapore  -9223372036854775808 = NULL
Singapore  -9223372036854689408 = NULL
Singapore  Mon Dec 31 17:04:34 1900 UT = Mon Dec 31 23:59:59 1900 LMT isdst=0 gmtoff=24925
Singapore  Mon Dec 31 17:04:35 1900 UT = Tue Jan  1 00:00:00 1901 SMT isdst=0 gmtoff=24925
Singapore  Wed May 31 17:04:34 1905 UT = Wed May 31 23:59:59 1905 SMT isdst=0 gmtoff=24925
Singapore  Wed May 31 17:04:35 1905 UT = Thu Jun  1 00:04:35 1905 +07 isdst=0 gmtoff=25200
Singapore  Sat Dec 31 16:59:59 1932 UT = Sat Dec 31 23:59:59 1932 +07 isdst=0 gmtoff=25200
Singapore  Sat Dec 31 17:00:00 1932 UT = Sun Jan  1 00:20:00 1933 +0720 isdst=1 gmtoff=26400
Singapore  Tue Dec 31 16:39:59 1935 UT = Tue Dec 31 23:59:59 1935 +0720 isdst=1 gmtoff=26400
Singapore  Tue Dec 31 16:40:00 1935 UT = Wed Jan  1 00:00:00 1936 +0720 isdst=0 gmtoff=26400
Singapore  Sun Aug 31 16:39:59 1941 UT = Sun Aug 31 23:59:59 1941 +0720 isdst=0 gmtoff=26400
Singapore  Sun Aug 31 16:40:00 1941 UT = Mon Sep  1 00:10:00 1941 +0730 isdst=0 gmtoff=27000
Singapore  Sun Feb 15 16:29:59 1942 UT = Sun Feb 15 23:59:59 1942 +0730 isdst=0 gmtoff=27000
Singapore  Sun Feb 15 16:30:00 1942 UT = Mon Feb 16 01:30:00 1942 +09 isdst=0 gmtoff=32400
Singapore  Tue Sep 11 14:59:59 1945 UT = Tue Sep 11 23:59:59 1945 +09 isdst=0 gmtoff=32400
Singapore  Tue Sep 11 15:00:00 1945 UT = Tue Sep 11 22:30:00 1945 +0730 isdst=0 gmtoff=27000
Singapore  Thu Dec 31 16:29:59 1981 UT = Thu Dec 31 23:59:59 1981 +0730 isdst=0 gmtoff=27000
Singapore  Thu Dec 31 16:30:00 1981 UT = Fri Jan  1 00:30:00 1982 +08 isdst=0 gmtoff=28800
Singapore  9223372036854689407 = NULL
Singapore  9223372036854775807 = NULL

Here’s how the man page explains this option:

 -v   
For each zonename on the command line, print the time at the lowest possible time value, the time
one day after the lowest possible time value, the times both one second before and exactly at each
detected time discontinuity, the time at one day less than the highest possible time value, and
the time at the highest possible time value. Each line ends with isdst=1 if the given time is
Daylight Saving Time or isdst=0 otherwise.

Q3. What the does the -c option do?

The -c option cuts the verbose output near the start of the given year(s). Here’s how the man page explains it:

-c [loyear,]hiyear

Cut off the verbose output near the start of the given year(s).  The output still includes the
lowest  possible  time  value and one day after it, and the highest possible time value preceded
by the time value one day before it.

Following is an example:

zdump -v -c 1935 Singapore

And here’s the output:

Singapore  -9223372036854775808 = NULL
Singapore  -9223372036854689408 = NULL
Singapore  Mon Dec 31 17:04:34 1900 UT = Mon Dec 31 23:59:59 1900 LMT isdst=0 gmtoff=24925
Singapore  Mon Dec 31 17:04:35 1900 UT = Tue Jan  1 00:00:00 1901 SMT isdst=0 gmtoff=24925
Singapore  Wed May 31 17:04:34 1905 UT = Wed May 31 23:59:59 1905 SMT isdst=0 gmtoff=24925
Singapore  Wed May 31 17:04:35 1905 UT = Thu Jun  1 00:04:35 1905 +07 isdst=0 gmtoff=25200
Singapore  Sat Dec 31 16:59:59 1932 UT = Sat Dec 31 23:59:59 1932 +07 isdst=0 gmtoff=25200
Singapore  Sat Dec 31 17:00:00 1932 UT = Sun Jan  1 00:20:00 1933 +0720 isdst=1 gmtoff=26400
Singapore  9223372036854689407 = NULL
Singapore  9223372036854775807 = NULL

Conclusion

Agreed, the zdump command is not the kind of tool that most of us will require everyday, but it’s a handy utility that you should know about, for you never know when you may be in need of it. More details about zdump can be accessed by heading to its man page.

Himanshu Arora

About Himanshu Arora

Himanshu Arora has been working on Linux since 2007. He carries professional experience in system level programming, networking protocols, and command line. In addition to HowtoForge, Himanshu’s work has also been featured in some of world’s other leading publications including Computerworld, IBM DeveloperWorks, and Linux Journal.

Share this page:

linux zdump command tutorial for beginners with examples 2
linux zdump command tutorial for beginners with examples 3
linux zdump command tutorial for beginners with examples 4
linux zdump command tutorial for beginners with examples 5

نوشته های مشابه