How to convert the dmesg timestamps to easier to read format on Linux?
Posted on In QAThe dmesg
results from newer Linux kernels show the timestamps. It seems the time in seconds since the kernel start time.
How to convert the dmesg timestamps to the real time on Linux?
The dmesg timestamp is the time in seconds since the kernel starting time.
Later dmesg
has an -T
option:
-T, –ctime
Print human-readable timestamps.
Be aware that the timestamp could be inaccurate! The time source used for the logs is not updated after system SUSPEND/RESUME.
So
dmesg -T
will print the real time stamps like
[Mon Oct 3 18:43:21 2016] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
[Mon Oct 3 18:53:22 2016] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
[Mon Oct 3 19:03:22 2016] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
[Mon Oct 3 19:13:23 2016] SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs