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 to change the clock time zone in CentOS 8 system

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail how to change the clock time zone of the CentOS 8 system. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

For many system-related tasks and processes, using the correct time zone is essential. For example, the cron daemon executes cron jobs using the system's time zone, and the timestamp in the log file is based on the same system's time zone.

Environment

Centos8

Check the current time zone

Timedatectl is a command-line utility that allows you to view and change the time and date of the system.

[root@localhost] # timedatectl Local time: Tue 2020-03-31 16:35:23 CST Universal time: Tue 2020-03-31 08:35:23 UTC RTC time: Tue 2020-03-31 08:35:23 Time zone: Asia/Shanghai (CST, + 0800) System clock synchronized: yes NTP service: active RTC in local TZ: no

Change the time zone

Before changing the time zone, you need to find out the name of the time zone you want to use. To list all available time zones, use the following command:

[root@localhost] # timedatectl list-timezones... Asia/SamarkandAsia/SeoulAsia/ShanghaiAsia/SingaporeAsia/Srednekolymsk...

Then use the set-timezone option to change the time zone, such as to Europe/Berlin:

[root@localhost ~] # timedatectl set-timezone Europe/Berlin

Change the time zone by creating a link

If you are running an older version of Centos, such as a previous version of Centos6, and the timedatectl command does not exist on the system, you can change the time zone by linking the / etc/localtime symbol to a time zone file in the / usr/share/zoneinfo directory.

Check the time zone file under / usr/share/zoninfo

[root@localhost ~] # ls / usr/share/zoneinfo/ [root@localhost ~] # ls / usr/share/zoneinfo/Asia/

Now replace the time zone file.

[root@localhost ~] # ln-sf / usr/share/zoneinfo/Asia/Shanghai / etc/localtime [root@localhost ~] # dateTue Mar 31 16:53:59 CST 2020

You can see that it has been switched to CST China Standard time.

In this article, you used two ways to modify the time zone. One is to use timedatectl, and the other is to create links.

About CentOS 8 system how to change the clock time zone to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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