In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how the Linux system adjusts the time zone". In the daily operation, I believe many people have doubts about how the Linux system adjusts the time zone. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how the Linux system adjusts the time zone". Next, please follow the editor to study!
Anyone who has installed a Linux system may have the experience that when the machine installed the windows system, the time was correct, but after installing the linux system, even though the time zone was selected correctly, the system time was not correct. This is due to the use of UTC when installing the system, so what is UTC? to put it simply, UTC is the time of 0 time zone, which is the international standard, while China is in the UTC+8 time zone.
View the current time zone of Linux
You can easily see the current time zone of the Linux system using the following command:
Datels-l / etc/localtime gets the time zone TZ value
To change the Linux system time zone, you must first know the TZ value of your local time zone. Use the tzselect command to view and select the installed time zone files.
Execute the tzselect command to select your continent, country, and city through the wizard
Tzselect will eventually output the value of your time zone in Posix TZ format (such as Asia/Shanghai), recording this.
Change the time zone for each user
Linux users are 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 the execution is complete, you need to log back in to the system or refresh ~ / .bashrc to take effect.
Source ~ / .bashrc changes the time zone of the Linux system
To change the system-wide time zone of the Linux system, use the following command:
Sudo rm-f / etc/localtimesudo ln-s / usr/share/zoneinfo/Asia/Shanghai / etc/localtime
❝
Note: replace the specific time zone in / usr/share/zoneinfo/Asia/Shanghai with the TZ value obtained by yourself.
Use Systemd to change the time zone of the Linux system
If your Linux system uses Systemd, you can also use the timedatectl command to change the Linux system-wide time zone. There is a system service called systemd-timedated under Systemd that adjusts the system clock and time zone, and we can configure this system service using the timedatectl command.
Sudo timedatectl set-timezone 'Asia/Shanghai' at this point, the study on "how to adjust the time zone of the Linux system" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.