Open In App

zdump command in Linux with Examples

Last Updated : 23 Sep, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

The zdump command in Linux is a valuable tool used to display the current time in various time zones. This command outputs the local time for each specified timezone, making it useful for developers, system administrators, or anyone working with multiple time zones. It also helps in analyzing time zone-related data, including daylight saving time (DST) changes and time discontinuities.

Syntax:

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

zdump command Basic Example

To check the current time in India, simply run:

zdump India

This outputs the local time for India’s time zone.

Key Options of the ‘zdump’ Comman d

1. -v: Verbose Output

This option is used to print the following time values.

Each line ends with isdst=1 if the given time is Daylight Saving Time or isdst=0 otherwise.

Example:

zdump -v Japan

-v: Verbose Output

  • 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.
  • The time at the highest possible time value.

2. -c: Cut Output for Specific Years

The -c option works in combination with -v and restricts the verbose output to a specific range of years. You can use this option to limit the output for time transitions and discontinuities within a given time period.

Example:

zdump -v -c 1930 Japan

-c: Cut Output for Specific Years

3. –version: Display zdump Version

The –version option prints the version of the zdump command currently installed on your system. This is useful for troubleshooting or ensuring compatibility with scripts that depend on specific versions.

zdump --version

4. –help: Display Help Information

Use the –help option to display a concise summary of the command’s options. This is handy for a quick reference to understand what options are available and how to use them.

zdump --help

Conclusion

The zdump command is a powerful tool for checking the current time in different time zones and analyzing time zone transitions, especially in relation to Daylight Saving Time. With options for verbose output and year-based filtering, it provides a detailed view of how time zones change over time.


Next Article

Similar Reads