How to convert the dmesg timestamps to easier to read format on Linux?

Posted on In QA

The 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

Eric Ma

Eric is a systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

Leave a Reply

Your email address will not be published. Required fields are marked *