linux命令之hwclock
1.hwclock介紹
linux命令hwclock是用來顯示硬件時鐘
2.hwclock用法
hwclock [參數]
參數 | 說明 |
-s | 讓系統時間同步硬件時間 |
-w | 讓硬件時間同步系統時間 |
3.實例
3.1.同步服務器時鐘時間
命令:
ntpdate pool.ntp.org
[root@rhel77 ~]# yum install ntpdate
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Package ntpdate-4.2.6p5-29.el7.x86_64 already installed and latest version
Nothing to do
[root@rhel77 ~]# ntpdate pool.ntp.org
21 Nov 08:56:14 ntpdate[3361]: adjust time server 202.118.1.130 offset -0.019736 sec
[root@rhel77 ~]#
3.2.顯示硬件時鐘的時間
命令:
hwclock
[root@rhel77 ~]# hwclock
Tue 21 Nov 2023 08:56:34 AM CST -0.615450 seconds
[root@rhel77 ~]#
3.3.讓系統時間同步硬件時間
命令:
hwclock -s
[root@rhel77 ~]# hwclock -s
[root@rhel77 ~]#
3.4.讓硬件時間同步系統時間
命令:
hwclock -w
[root@rhel77 ~]# hwclock -w
[root@rhel77 ~]#