Linux服务器时间/时区设置

Linux服务器时间/时区设置

时间:2013-10-29 07:10:33      作者:vaster      标签: Linux 时区设置 时间设置      分类: Linux Linux基础

时区相关操作:

(1)查看时区

[root@hk-LDJ-180 ~]# date -R
Wed, 09 Oct 2013 16:56:23 +0800
[root@hk-LDJ-180 ~]# ll /etc/localtime
lrwxrwxrwx 1 root root 34 Oct  9 16:56 /etc/localtime -> /usr/share/zoneinfo/Asia/Chongqing
[root@hk-LDJ-180 ~]# cat /etc/sysconfig/clockZONE="Asia/Shanghai"
ZONE="Asia/Shanghai"

(2)修改时区:

 [root@hk-LDJ-180 ~]# ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
 [root@hk-LDJ-180 ~]# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime [root@hk-LDJ-180 ~]# tzselect
 [root@hk-LDJ-180 ~]# tzselect

系统时间的操作 /bin/date:

(1)将时间调整为10月11日凌晨1点55分

[root@hk-LDJ-180 ~]# data 10110155

(2)将系统时间设定成2005年8月8日:

[root@hk-LDJ-180 ~]# date -s 2005/08/08

(3)将系统时间设定成下午8点12分0秒:

[root@hk-LDJ-180 ~]# date -s 20:12:00

(4)查看系统时间

[root@hk-LDJ-180 ~]# dateWed Oct  9 17:18:33 CST 2013
Wed Oct  9 17:18:33 CST 2013

(5)查看utc时间

[root@hk-LDJ-180 ~]# date –uWed Oct  9 09:18:39 CST 2013
Wed Oct  9 09:18:39 CST 2013

硬件时间的操作 /sbin/hwclock:

(1)更新机器的硬件时间。

[root@hk-LDJ-180 ~]# hwclock --adjust

(2)重置硬件时钟用

[root@hk-LDJ-180 ~]# hwclock --set --date=mm/dd/yy hh:MM:ss" (重启后会失效)

(3)查看硬件时钟 (换算后的)

[root@hk-LDJ-180 ~]# hwclock –show

( 4 ) BIOS中实际的时间

[root@hk-LDJ-180 ~]# hwclock –localtime

系统时间与硬件时间

(1)将硬件时钟系统时间同步到 Linux 操作系统时间的命令为:

[root@hk-LDJ-180 ~]# /sbin/hwclock --hctosys

(2)将 Linux 操作系统时间同步到硬件时钟系统时间的命令为:

[root@hk-LDJ-180 ~]# /sbin/hwclock --systohc

 

 

时间:2013-10-29 07:10:33      作者:vaster      标签: Linux 时区设置 时间设置      分类: Linux Linux基础
  • 分享到:
  • 微博
  • QQ空间
  • 腾讯微博
  • 微信

Copyright © 2015 Gitblog | Proudly powered by Gitblog.