In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
In this issue, the editor will bring you about how to set the time and date in the CentOS 7 system. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
Show current time zone
Use the following command:
The code is as follows:
~] $localectl status
System Locale: LANG=en_US.UTF-8
VC Keymap: us
X11 Layout: n/a
As you can see, in addition to the time zone information of the system, keyboard information and X11 layout information are also displayed
List all time zones
Display all English time zones with the following command
The code is as follows:
~] $localectl list-locales | grep en_
En_AG
En_AG.utf8
En_AU
En_AU.iso88591
En_AU.utf8
En_BW
En_BW.iso88591
En_BW.utf8
If you want to display it in Chinese, just change grep en to grep zh.
Set the local time zone
Use Root to execute the following command:
The code is as follows:
Localectl set-locale LANG=locale
Replace the final locale with a specific time zone, such as zh_CN.UTF-8.
Isn't that powerful.
Timedatectl
Let's solemnly introduce the timedatectl command ~
In previous versions of CentOS, time was set with a series of commands such as date, hwclock, etc., but CentOS 7 started with a unified command:
The code is as follows:
Timedatectl
This command is very powerful, starting with the direct use of some information that shows the current system time:
The code is as follows:
~] $timedatectl
Local time: Mon 2013-09-16 19:30:24 CEST
Universal time: Mon 2013-09-16 17:30:24 UTC
Timezone: Europe/Prague (CEST, + 0200)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
DST active: yes
Last DST change: DST began at
Sun 2013-03-31 01:59:59 CET
Sun 2013-03-31 03:00:00 CEST
Next DST change: DST ends (the clock jumps one hour backwards) at
Sun 2013-10-27 02:59:59 CEST
Sun 2013-10-27 02:00:00 CET
Set the current date:
Using Root, execute the following command:
The code is as follows:
Timedatectl set-time YYYY-MM-DD
Set the current time:
You still need Root permission.
The code is as follows:
Timedatectl set-time HH:MM:SS
By default, the system uses UTC time, which can be turned on and off with the following command:
The code is as follows:
Timedatectl set-local-rtc boolean
Replacing boolean with yes means using local time, and replacing with no means UTC time.
Set any time zone
You can view all time zones with the following command:
The code is as follows:
Timedatectl list-timezones
Then set the time zone with the following command:
The code is as follows:
Timedatectl set-timezone time_zone
Of course, root authority is inevitable.
Synchronize with a remote NTP server
Timedatectl can also set whether or not to turn on the NTP option
The code is as follows:
Timedatectl set-ntp boolean
This is how to set the time and date in the CentOS 7 system shared by the editor. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are 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.