Write the current system clock to the hardware clock and treat the RTC as UTC.
Which command is appropriate?
--systohc writes system time to the RTC and --utc specifies UTC interpretation.
Detailed explanation
hwclock --hctosys --utcIncorrect. --hctosys reads from the RTC in the opposite direction.
Incorrect. --hctosys reads from the RTC in the opposite direction.
hwclock --systohc --utcCorrect. It writes system time to the UTC RTC.
Correct. It writes system time to the UTC RTC.
hwclock --show --utcIncorrect. --show only displays the RTC.
Incorrect. --show only displays the RTC.
date -u > /etc/localtimeIncorrect. /etc/localtime is timezone data, not an RTC destination.
Incorrect. /etc/localtime is timezone data, not an RTC destination.
Try it yourself
An example you can run in a temporary verification environment.
hwclock --help 2>&1 | grep -E -- '--systohc|--utc' | head -n 2Expected result
--systohcと--utcのhelp行Key points
- system to RTC
- --utc
- Direction matters
Notes
- Environment: util-linux hwclock helpの読取のみ
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.