In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
Most people don't understand the knowledge points of this article "how to modify linux time zone", so Xiaobian summarizes the following contents for everyone. The contents are detailed, the steps are clear, and they have certain reference value. I hope everyone can gain something after reading this article. Let's take a look at this article "how to modify linux time zone".
Methods: 1. Use commands such as "sudo rm -f /etc/localtime" to modify the system time zone;2. Use Systemd to change the Linux system time zone, with the syntax of "sudo timedatetl set-timezone 'timezone'".
Operating environment: Linux 7.3 system, Dell G3 computer.
How to change linux time zone
If your Linux system time zone is not configured correctly, you must manually adjust it to the correct local time zone. NTP time synchronization only calculates the offset between local time and UTC time, so configuring an NTP to synchronize time does not solve the problem of incorrect time zones. Therefore, when you use foreign cloud computing service providers such as Microsoft Azure or other VPS and virtual machines, you need to pay attention to whether it is consistent with the time zone of the mainland of China.
View Linux current time zone
You can easily check the current time zone of your Linux system by using the following command:
datels -l /etc/localtime
Get Time Zone TZ Value
To change the Linux system time zone, you first need to know the TZ value of your local time zone. Use tzselect command to view and select the installed time zone file.
Execute tzselect command
Choose your continent, country and city via the wizard
tzselect will eventually print out your time zone value in Posix TZ format (e.g. Asia/Shanghai) and record it.
Change the time zone for each user
Linux users A multi-user system, each user can configure their own time zone, you can add a TZ environment variable for yourself:
export TZ='Asia/Shanghai'
After execution, you need to log in again or refresh ~/.bashrc to take effect.
source ~/.bashrc
Change Linux system time zone
To change the system-wide time zone of a Linux system, use the following command:
sudo rm -f /etc/localtimesudo ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
Note: Please replace the specific time zone in/usr/share/zoneinfo/Asia/Shanghai with the TZ value obtained by yourself.
Change the Linux system time zone using Systemd
If your Linux system uses Systemd, you can also use the timedatetl command to change the Linux system-wide time zone. Under Systemd, there is a system service called systemd-timed that adjusts the system clock and time zone, and we can configure this system service using the timedatetl command.
sudo timedatectl set-timezone 'Asia/Shanghai'
The above is the content of this article on "how to modify linux time zone". I believe everyone has a certain understanding. I hope that the content shared by Xiaobian will help everyone. If you want to know more relevant knowledge, please pay attention to 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.