linux幫助文檔linux幫助文檔
Linux系統(tǒng)服務(wù)器如何修改系統(tǒng)時間
一、查看當(dāng)前的系統(tǒng)時間:命令date
二、修改時區(qū):timedatectl set-timezone Asia/Shanghai
三、修改時間:
1、手動修改:
①修改系統(tǒng)時間:date -s "2022-01-28 13:06:06"
②同步系統(tǒng)時間和硬件時間:hwclock --hctosys
③本地時間寫入硬件時間:timedatectl set-local-rtc 1
④重啟系統(tǒng):reboot
2、自動修改:
①安裝ntpdate工具:yum -y install ntp ntpdate
②設(shè)置系統(tǒng)時間與網(wǎng)絡(luò)時間同步:ntpdate cn.pool.ntp.org或ntpdate time.windows.com
③將系統(tǒng)時間寫入硬件時間:hwclock --systohc
④強(qiáng)制系統(tǒng)時間寫入CMOS中防止重啟失效:hwclock -w
⑤重啟系統(tǒng):reboot