一、時(shí)間
1、查看時(shí)間和日期
date
2、設(shè)置時(shí)間和日期
將系統(tǒng)日期設(shè)定成1996年6月10日的命令
date -s 06/22/96
將系統(tǒng)時(shí)間設(shè)定成下午1點(diǎn)52分0秒的命令
date -s 13:52:00
3. 將當(dāng)前時(shí)間和日期寫入bios,避免重啟后失效
hwclock -w
二、時(shí)區(qū)
1. 查看當(dāng)前時(shí)區(qū)
date -r
2. 修改設(shè)置時(shí)區(qū)
方法(1)
tzselect
方法(2) 僅限于redhat linux 和 centos
timeconfig
方法(3) 適用于debian
dpkg-reconfigure tzdata
3. 復(fù)制相應(yīng)的時(shí)區(qū)文件,替換系統(tǒng)時(shí)區(qū)文件;或者創(chuàng)建鏈接文件
cp /usr/share/zoneinfo/$主時(shí)區(qū)/$次時(shí)區(qū) /etc/localtime
在中國(guó)可以使用:
cp /usr/share/zoneinfo/asia/shanghai /etc/localtime
三、定時(shí)同步時(shí)間
* * * * * /usr/sbin/ntpdate 210.72.145.44 > /dev/null 2>&1