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 modify time in Linux system

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article is about how to modify the time in the Linux system, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

When installing the Linux system, it is sometimes encountered that the time of the Linux system is inconsistent with that of the windows system, and it may be that UTC is used when installing the system.

I. manual modification

\ 1. Date command: view current time

\ 2. Date-s minutes and seconds: modification time

We still need to change the date.

\ 3. Date-s full date time (YYYY-MM-DD hh:mm [: ss]): date and time of modification

Time should be enclosed in double quotation marks, otherwise an error will be reported.

There is a certain time error in manual modification.

4. Hwclock-w

Write the time to bios to avoid restart failure.

When we finish calibrating the Linux time, we also need to update the BIOS time with hwclock, because each time the system is restarted, the time will be re-read by the BIOS, so BIOS is the important time basis.

Second, synchronize network time

\ 1. Check if the ntp service is installed on the system

Install the ntp service command:

Apt-get install ntp or yum install ntp

\ 2. Service-status-all: check whether the ntp service is started

[+] indicates that the service has been started

\ 3. Ntpdate server IP: synchronize server time

Ntp commonly used servers:

China National time Service Center: 210.72.145.44

NTP Server (Shanghai): ntp.api.bz

United States: time.nist.gov

Fudan: ntp.fudan.edu.cn

Microsoft time Service Host (USA): time.windows.com

Taiwan Police time Service Center (Taiwan): asia.pool.ntp.org

(⊙ ⊙) b, there seems to be a problem.

Replace the server with Shanghai's.

The time is still one minute short. Manually change the time to the current time interval, and then synchronize and find that there is a problem. The server time is not correct at all. It takes half a day to do so.

Using the Microsoft time service host (USA), it is found that the server time is about the same as that in Shanghai. Is there a problem with the time zone setting?

\ 4. Modify server time zone

4.1 date-R: view the current time zone

Another server (normal time) time zone:

So, it's time to change the time zone.

4.2 tzselect

The time zone didn't change back.

Last step

The above is how to modify the time in the Linux system. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

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

Development

Wechat

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

12
Report