1、查看系统时间
[root@test3 ~]# date
Thu Dec 20 23:25:33 CST 2012
[root@test3 ~]# date +"%Y%m%d %H:%m:%S"
20121220 23:12:54
2、查看硬件时间
系统时钟是指当前Linux Kernel中的时钟,而硬件时钟则是主板上由电池供电的时钟,这个硬件时钟可以在BIOS中进行设置。当Linux启动时,硬件时钟会去读取系统时钟的设置,然后系统时钟就会独立于硬件运作。
[root@test3 ~]# hwclock
Thu 20 Dec 2012 02:57:09 PM CST -0.176702 seconds
[root@test3 ~]# clock
Thu 20 Dec 2012 02:57:14 PM CST -0.575501 seconds
3、修改系统时间
[root@test3 ~]# date
Thu Dec 20 23:27:43 CST 2012
[root@test3 ~]# date -s "20121220 15:28:00"
Thu Dec 20 15:28:00 CST 2012
[root@test3 ~]# date
Thu Dec 20 15:28:03 CST 2012
4、修改硬件时间
[root@test3 ~]# hwclock
Thu 20 Dec 2012 03:30:58 PM CST -0.119534 seconds
[root@test3 ~]# hwclock --set --date="