hwclock
system administrationLinux
The hwclock command is one of the most frequently used commands in Linux/Unix-like operating systems. hwclock Query or set the hardware clock (RTC)
Quick Reference
Command Name:
hwclock
Category:
system administration
Platform:
Linux
Basic Usage:
hwclock [options] [arguments]
Common Use Cases
Syntax
hwclock [options]
Options
Option | Description |
---|---|
-r, --show |
Read and display the hardware clock |
--get |
Read hardware clock and print drift-corrected result |
--set |
Set the hardware clock to the time given with --date |
--hctosys |
Set the system time from the hardware clock |
--systohc |
Set the hardware clock from the system time |
--adjust |
Adjust the RTC to account for systematic drift |
--utc |
The hardware clock is kept in UTC |
--localtime |
The hardware clock is kept in local time |
--date=date_string |
Specifies the time to which to set the hardware clock |
--update-drift |
Update drift factor in /etc/adjtime |
--noadjfile |
Do not use /etc/adjtime |
--adjfile=file |
Use specified file instead of /etc/adjtime |
--test |
Do not update anything, just show what would happen |
--debug |
Display more details about what is being done |
--help |
Display help information and exit |
--version |
Output version information and exit |
Examples
How to Use These Examples
The examples below show common ways to use the hwclock
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
# Basic Examples Basic
sudo hwclock