首页  ·  知识 ·  基础设施
主流UNIX和linux操作系统修改时区的方法
网友   http://www.ilearn.net.cn/soft/674.html  数据中心  编辑:德仔   图片来源:网络
在主流UNIX和linux的OS中,如何修改时区(timezone)? 解决方案:

在主流UNIX和linux的OS中,如何修改时区(timezone)?

 

解决方案:

一、Linux(Redhat and Suse):

1、在/usr/share/zoneinfo/目录下查询想要更换的时区名称,修改格式同上

2、将原有的localtime文件移走;

   # mv /etc/localtime /etc/localtime-old

3、做新的localtime文件,将对应的时区文件链接过来

   # ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

4、与硬件(bios)同步

   # /sbin/hwclock --systohc

二、Unix系统(不包括Linux),可以通过echo $TZ来查看当前时区。 

solaris中,修改时区需要修改/etc/TIMEZONE文件,其中的TZ=PRC就表示中国时区,我们可以将其替换为TZ=US/Pacific,再重启机器,就将时区修改为美国太平洋时区了。需要注意三点:

1、在X86的机器上,需要再执行如下命令,更新/etc/rtc_config文件:

   # rtc -z zone-name(这里的zone-name就是/etc/TIMEZONE中TZ的值)

   # rtc -c

2、到底有多少时区可以选择呢?我们可以进入/usr/share/lib/zoneinfo目录,其中有很多目录,包括US,也有很多文件,比如PRC;这表示US下还有很多时区,而PRC就是统一的时区。正因为如此,我们才看到TZ=PRC和TZ=US/Pacific这两种不同的形式。

3、需要重启系统使之生效。

 

 

三、AIX:

1、查看当前时区(其他操作系统使用date命令即可)

   #cat /etc/environment (查找TZ所在行)

2、为了妥善起见,建议使用smit修改时区

   #smit chtz

3、所有的时区信息在/usr/share/lib/zoneinfo目录

 

四、HPUX:

# set_parms timezone,可以通过交互的方式来修改时区。

我学习网www.ilearn.net.cn为您提供英文内容:
 
UNIX and linux in the mainstream of the OS, how to modify the time zone (timezone)?

  

Solution:

1, Linux (Redhat and Suse):

1, in the / usr / share / zoneinfo / directory inquiries, the time zone you want to replace the name, modify the format Ibid

2, will remove the original file localtime;

    # Mv / etc / localtime / etc / localtime-old

3, do localtime new documents, will be the corresponding time zone file link from

    # Ln-s / usr / share / zoneinfo / Asia / Shanghai / etc / localtime

4, and hardware (bios) synchronization

    # / Sbin / hwclock - systohc

Second, Unix system (not including Linux), can echo $ TZ to see the current time zone.

In solaris, the modifications need to modify the time zone / etc / TIMEZONE file, which indicated that TZ = PRC on the Chinese time zone, we can replace TZ = US / Pacific, and then restart the machine, it will be revised to the United States time zone the Pacific time zone. Need to pay attention to three points:

1, the machine in the X86, the need to implement the following command to update the / etc / rtc_config documents:

    # Rtc-z zone-name (here, zone-name is / etc / TIMEZONE values in TZ)

    # Rtc-c

2, in the end the number of time zones can be a choice? We can enter the / usr / share / lib / zoneinfo directory, of which there are many directories, including the US, there are many documents, such as the PRC; This means that there are still many under the US time zones, and the PRC is a unified time zone. This is why we only see the TZ = PRC and TZ = US / Pacific these two different forms.

3, the need to reboot the system to bring it into force.

  


Third, AIX:

1, view the current time zone (other operating systems can use the date command)

    # cat / etc / environment (where the line to find TZ)

2, in order to properly sake, it is proposed to amend the use of time zone smit

    # smit chtz

3, all of the time zone information in / usr / share / lib / zoneinfo directory

  

Fourth, HPUX:

# Set_parms timezone, can interact to modify the time zone.
本文作者:网友 来源: http://www.ilearn.net.cn/soft/674.html
CIO之家 www.ciozj.com 微信公众号:imciow
    >>频道首页  >>网站首页   纠错  >>投诉
版权声明:CIO之家尊重行业规范,每篇文章都注明有明确的作者和来源;CIO之家的原创文章,请转载时务必注明文章作者和来源;
延伸阅读
也许感兴趣的
我们推荐的
主题最新
看看其它的