How to modify the time zone in Linux and Unix

Source: Internet
Author: User
Tags time zones

Most of the current cluster software requires a time difference of no more than 1000 seconds between multiple machines. Therefore, if you use the date command to modify the time, this is not much to say. However, sometimes the time of the two machines is the same, but the time zone is different, the user has to modify the time zone of the machine, which is different in different operating systems, the following describes how to change the time zone of mainstream operating systems:
Solaris: in solaris, the/etc/TIMEZONE file needs to be modified to modify the time zone. The TZ = PRC indicates the China time zone. We can replace it with TZ = US/Pacific, restart the machine and change the time zone to the US Pacific time zone. Note the following three points: 1. On the X86 machine, run the following command to update the/etc/rtc_config file: # rtc-z zone-name (the zone-name here is the TZ value in/etc/TIMEZONE) # rtc-c2. How many time zones can be selected? We can enter the/usr/share/lib/zoneinfo Directory, which contains many directories, including US and many files, such as PRC. This indicates that there are many time zones in US, the PRC is the unified time zone. That's why we see the two different forms of TZ = PRC and TZ = US/Pacific. 3. restart the system to make it take effect.
Linux (Redhat and Suse): 1. query the name of the time zone to be changed in the/usr/share/zoneinfo/directory. modify the format as above 2 and remove the original localtime file; # mv/etc/localtime/etc/localtime-old3, make a new localtime file, link the corresponding time zone file # ln-s/usr/share/zoneinfo/Asia/Shanghai/etc/localtime4, in sync with hardware #/sbin/hwclock -- systohc
AIX: 1, view the current time zone (other operating systems are the date command) cat/etc/environment (find the row where TZ Is located) 2, for the sake of safety, we recommend that you use smit to modify the time zone smit chtz3. All the time zone information is in the/usr/share/lib/zoneinfo directory.
HPUX: 1, # set_parms timezone. You can change the time zone through interaction. For all Unix systems (excluding Linux), you can use echo $ TZ to view the current time zone. Author qinggzha

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.