Forrest logo
back to the hwclock tool

hwclock:tldr:484da

hwclock: Display the current time as reported by the hardware clock.
$ hwclock
try on your machine

The command "hwclock" is a Linux command used to display or set the hardware clock (also known as the Real Time Clock or RTC) of a computer.

When the system shuts down or reboots, the current time and date are saved to the hardware clock, which is an independent clock in the computer's hardware. On the next system startup, the system reads the hardware clock and sets the system time accordingly.

Usage of the "hwclock" command:

  1. Displaying the hardware clock: The basic usage of "hwclock" without any arguments or options displays the current time and date of the hardware clock.

  2. Applying the system time to the hardware clock: The "--systohc" or "--hctosys" option synchronizes the system time with the hardware clock. It sets the time of the hardware clock to the system time or vice versa.

  3. Setting the hardware clock: By using the "--set" option along with the desired time and date, you can manually set the hardware clock.

  4. Adjusting for time drift: The "--adjust" or "-a" option adjusts the time of the hardware clock based on the estimated drift since the last update.

  5. Timezone conversion: The "-r" option displays the time from the hardware clock after converting it to the currently set time zone.

It is important to note that the "hwclock" command usually requires root or superuser privileges to execute, as it deals with low-level hardware operations.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the hwclock tool