In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to synchronize server time in Linux system", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to synchronize server time in Linux system" this article.
Common commands for Linux time operations date commands
Mode of use:
Date [- u] [- d datestr] [- s datestr] [--utc] [--universal] [--date=datestr] [--set=datestr] [--help] [--version] [+ FORMAT] [MMDDhhmm [[CC] YY] [.ss]]
1.date: view the current time, and the results are as follows:
[root@linuxprobe] # date2016, Friday, April 29, 2009, 23:04:30 CST
2.date'+% Y% M% D' displays the current date in the format. The result is as follows:
[root@linuxprobe ~] # date "+% Y-%m-%d% H:%M:%S" 2016-04-29 23:30:12
3.date-s "xxx xx:xx:xx" sets the system time
[root@linuxprobe] # date-s "20160429 15:30:00" Friday, April 29, 2016, 15:30:00 CST
The above commands are common operations of linux system time. For specific commands, see: "this is how linux should learn." Chapter 2: Linux commands that beginners must master.
Time synchronization of linux
Let's take a look at how to set the correct environment for multiple linux in a complex environment: right-time synchronization command: utpdate time server ip ntpdate-u xx.xx.xx.xx results as follows:
[root@linuxprobe ~] # ntpdate-u ntp.api.bz29 Apr 15:26:27 ntpdate [2667]: step time server 61.153.197.226 offset-311.570389 sec [root@linuxprobe ~] # date2016 Friday, April 29, 2009, 15:26:32 CSTps: without the-u parameter, the following prompt will appear: no server suitable for synchronization found-u: you can see from the man ntpdate that the-u parameter can be synchronized with the host through the firewall
Ntp commonly used servers:
China National time Service Center: 210.72.145.44NTP Server (Shanghai): ntp.api.bz USA: time.nist.gov Fudan: ntp.fudan.edu.cn Microsoft time Service Host (USA): time.windows.com Beijing University of posts and Telecommunications: s1a.time.edu.cn Tsinghua University: s1b.time.edu.cn Peking University: s1c.time.edu.cn Taiwan Police Grand time Service Center (Taiwan): asia.pool.ntp.org time Zone Operation
View the time zone:
1.date "+% Z"
[root@linuxprobe ~] # date "+% Z" [root@linuxprobe ~] # CST
two。 Use cat / etc/sysconfig/clock to view the current time zone
[root@linuxprobe ~] # cat / etc/sysconfig/clock# The time zone of the system is defined by the contents of / etc/localtime.# This file is only for evaluation by system-config-date, do not rely on its# contents elsewhere.ZONE= "Asia/Shanghai" sets the time zone:
Copy the corresponding time zone file and replace the system default time zone file link method [root@linuxprobe ~] # cp / usr/share/zoneinfo/Asia/Shanghai / etc/localtime [root@linuxprobe ~] #
Ps: / usr/share/zoneinfo is the time zone location of all impassable areas [root@linuxprobe ~] # ls / usr/share/zoneinfo/Asia/Aden Bahrain Chungking Harbin Jerusalem Kuala_Lumpur Nicosia Qyzylorda Seoul Thimphu Yekaterinburg... Almaty Baku ColomboBaghdad Chongqing Gaza Jayapura Krasnoyarsk Muscat Qatar Samarkand Thimbu Yakutsk writes system time to hardware (bios)
1.hwclock
[root@linuxprobe ~] # hwclock Friday, April 29, 2016 15:39:30-0.375972 seconds
2.clock-w
[root@linuxprobe ~] # clock-w [root@linuxprobe ~] # above is all the content of this article "how to synchronize server time in Linux system". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.