4 ms·
Coolest thing I learned a while back is "dmesg -T" - Dmesg with timestamps ! Who knew :P
by rawoke083600 8y ago
Coolest thing I learned a while back is "dmesg -T" - Dmesg with timestamps ! Who knew :P
- craftyguy 8y ago`dmesg -H` is one I use most often, it enables viewing output in a pager. `-w` is also useful, it 'follows' the output (doesn't return and prints more output as it is received)
- grafelic 8y agoThe timestamps output by dmesg -T are inaccurate - e.g. on virtual machines that are frequently snapshotted for backup. This is clearly stated in the manpage: -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.
- aepiepaey 8y agoThe timestamps use linux' local_clock (which is per-cpu). It will also drift, even if you never suspend/resume. The longer the uptime, the higher this discrepancy can be. This means the timestamp is useless for many purposes. You can check the current offset using: echo test >> /dev/kmsg && uptime=$(cut -d' ' -f 1 /proc/uptime ) && timestamp=$(dmesg |tail -1| awk -F '[][]' {'print $2'}) && echo "$timestamp-$uptime" | bc
- shodan666 8y agoAre you aware that in good old days [Linux 2.5 ?] it was default dmesg output?