Seems simple, but couldn't find any answer:
Is it possible to edit a file for the purpose of updating the Linux date instead of using date +%y%m%d -s "DATE"
command?
Seems simple, but couldn't find any answer:
Is it possible to edit a file for the purpose of updating the Linux date instead of using date +%y%m%d -s "DATE"
command?
There's no file representing the current system time on Linux. Linux gets the current time from the RTCs (real-time clocks) or from external sources like NTP servers, and then keeps track of it internally. The file-like representations of the RTC (/dev/rtc*
) are used for configuring and recieving alarms, and can't be used for setting the time. The RTC status file (/proc/driver/rtc
) is read-only. See the kernel documentation for details.
date
uses the clock_settime(2)
function. You can use strace
to examine what the commands actually do.