Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does linux query the time zone

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to query the time zone in linux". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "how to query the time zone by linux"!

Methods: 1, using date command, syntax is "date +" Z% z ""; 2, using timedatectl command, syntax is "timedatectl | grep" Time zone ""; 3, using cat command, syntax is "cat / etc/timezone".

The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

How does linux query the time zone?

1. Let's start with using the traditional date command

Take a look at our current time zone using the following command:

$date

Alternatively, you can use the following command. Where the% Z format can output the time zone in the form of characters, and the% z can output the time zone in numeric form:

$date + "Z z"

God teaches you to check your time zone in Linux. God teaches you to check your time zone in Linux.

Note: date's man page contains many output formats that you can use to replace the output of your date command:

$man date

2. Next, you can also use the timedatectl command

When you run it without any parameters, this command outputs an overview of the system time, including the current time zone, as shown in the following figure:

$timedatectl

You can then provide a pipe in the command and use the grep command to filter out only the time zone information as follows:

$timedatectl | grep "Time zone"

God teaches you to check your time zone in Linux. God teaches you to check your time zone in Linux.

Similarly, we can learn how to use timedatectl to set the Linux time zone.

3. Further, display the contents of the file / etc/timezone

Use the cat tool to display the contents of the file / etc/timezone to view your time zone:

$cat / etc/timezone

For RHEL/CentOS/Fedora users, here is another command that has the same effect:

Grep ZONE / etc/sysconfig/clock so far, I believe you have a better understanding of "how to query the time zone in linux". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report