Introduction
The hwclock command is a Linux utility used to view and set the hardware clock (also known as the Real Time Clock or RTC) on a Linux system. It is used to set the system time from the hardware clock, and to set the hardware clock from the system time. The hwclock command is part of the util-linux package and is available on most Linux distributions.
Examples
The hwclock command is used to query and set the hardware clock (also known as the Real Time Clock or RTC). It can be used to set the system time from the hardware clock, or to set the hardware clock from the system time.
Syntax:
hwclock [options]
Options:
-r, –show: Show the current hardware clock time
-s, –hctosys: Set the system time from the hardware clock
-w, –systohc: Set the hardware clock from the system time
-l, –localtime: Set the hardware clock to local time
-u, –utc: Set the hardware clock to UTC time
The hwclock
command is a Linux utility used to view and set the hardware clock (also known as the Real Time Clock or RTC) on your system. It is a useful tool for setting the time and date on your system, as well as synchronizing the hardware clock with the system clock.
The hwclock
command can be used to view the current time and date of the hardware clock, as well as set the hardware clock to a specific time and date. It can also be used to synchronize the hardware clock with the system clock, which is useful if the hardware clock is running slow or fast.
To view the current time and date of the hardware clock, use the following command:
hwclock --show
This will display the current time and date of the hardware clock.
To set the hardware clock to a specific time and date, use the following command:
hwclock --set --date="MM/DD/YYYY HH:MM:SS"
Replace the MM/DD/YYYY HH:MM:SS with the desired date and time.
To synchronize the hardware clock with the system clock, use the following command:
hwclock --systohc
This will set the hardware clock to the same time and date as the system clock.
The hwclock
command is a useful tool for managing the hardware clock on your system. It can be used to view the current time and date of the hardware clock, as well as set the hardware clock to a specific time and date, and synchronize the hardware clock with the system clock.