Learn how to inspect and correct the real-time clock (RTC) on a Linux machine using the command-line tool hwclock. 09.02.2026 | reading time: 3 min When the RTC on a machine drifts or the system clock is wrong, he must sometimes update the hardware clock directly; the standard tool is `hwclock`, which reads and writes the battery-backed RTC from userspace. Quick, real command example A short session that shows the system clock, the RTC before change, sync from system to RTC, and the RTC after change: ```bash $ date Sun Feb 9 14:12:03 UTC 2026 $ sudo hwclock --show 2026-02-09 14:01:58.000000+00:00 $ sudo hwclock --systohc --utc $ sudo hwclock --show 2026-02-09 14:12:03.000000+00:00 ``` Set a specific hardware time To set the RTC to a specific timestamp use `hwclock --set --date "YYYY-MM-DD HH:MM:SS"` and choose `--utc` or `--localtime` to match how the RTC is interpreted; for example, to set the RTC exactly to the current system time one can also run `sudo hwclock --systohc --utc` which writes system time into the RTC. Options and interactions that matter Key options are `--show` (read), `--set --date` (write a specific time), `--systohc` (system to hardware) and `--hctosys` (hardware to system); decide between `--utc` and `--localtime` depending on BIOS/UEFI configuration, disable automatic NTP sync first if necessary, and prefer `--noadjfile` or `--adjfile` when adjusting drift files; remember that NTP clients such as chronyd or systemd-timesyncd can overwrite clock changes, so stop them when making controlled adjustments. When manual setting is useful Manual RTC edits are handy on air-gapped systems, rescue environments, VMs with broken emulation, or embedded devices that lost battery power; a correct RTC avoids weird certificate, logging and cron issues during boot and can be part of a reproducible recovery workflow. Complementary tools to know Use `timedatectl` to view and configure system time settings and RTC mode, manage NTP with `systemctl` and `systemd-timesyncd` or `chronyd`/`ntpd`, and use `rtcwake` when testing wake/suspend scenarios that depend on the hardware clock. Final thought Mastering hwclock and the surrounding time stack prevents tricky production incidents and is a practical skill for any Linux engineer; deepen that competence and consider formal certification like CompTIA Linux+ or LPIC-1 and intensive exam preparation at bitsandbytes.academy to turn hands-on skill into certified expertise. Join Bits & Bytes Academy First class LINUX exam preparation. setup utilities boot-process troubleshooting infrastructure