NickTheGreek 160 Report post Posted February 4, 2019 dmesg_with_human_timestamps () { FORMAT="%a %b %d %H:%M:%S %Y" now=$(date +%s) cputime_line=$(grep -m1 "\.clock" /proc/sched_debug) if [[ $cputime_line =~ [^0-9]*([0-9]*).* ]]; then cputime=$((BASH_REMATCH[1] / 1000)) fi dmesg | while IFS= read -r line; do if [[ $line =~ ^\[\ *([0-9]+)\.[0-9]+\]\ (.*) ]]; then stamp=$((now-cputime+BASH_REMATCH[1])) echo "[$(date +"${FORMAT}" --date=@${stamp})] ${BASH_REMATCH[2]}" else echo "$line" fi done } alias dmesgt=dmesg_with_human_timestamps https://stackoverflow.com/questions/13890789/convert-dmesg-timestamp-to-custom-date-format Quote Share this post Link to post Share on other sites
Clanwarz 0 Report post Posted December 9, 2019 I use this code. Pretty nice Have you thought about formatting it in colors as dmesg is formatted now? Quote Share this post Link to post Share on other sites