Home >Operation and Maintenance >Linux Operation and Maintenance >Detailed explanation of hwclock command
hwclock Introduction
The hwclock command is used to set or read the system hardware clock. This clock is usually a battery-powered clock on the computer's motherboard.
Set the clock
To set the hardware clock, use the following syntax:
<code>hwclock --set --date="MMDDhhmm[[[[cc]yy]]]"</code>
Where:
For example, to To set the hardware clock to January 1, 2023, 12:00 AM, use the following command:
<code>hwclock --set --date="010100002023"</code>
Read Clock
To read the hardware clock, Just enter the following command:
<code>hwclock</code>
It will print the current clock value in your console.
Options
The hwclock command also provides the following options:
Example
To synchronize the hardware clock with the system clock, use the following command:
<code>hwclock --systohc</code>
To copy from file timebackup To restore the time of a previous backup, use the following command:
<code>hwclock --restore --file=/path/to/timebackup</code>
The above is the detailed content of Detailed explanation of hwclock command. For more information, please follow other related articles on the PHP Chinese website!