Dmesg with real time

Is it possible to display dmesg with real time instead of the default secs?




using the “real” dmesg command, the “-T” option displays the timestamp.
But it’s not available with Busybox’s dmesg…

You can pipe the output of dmesg to a Python script :

Thanks for the suggestion, however that python script is giving the following errors:

Traceback (most recent call last):
File “./pydmesg”, line 20, in
_dmesg_line_regex = re.compile("^[(?P<time>\d+.\d+)](?P<line>.*)$")
File “/usr/lib/python2.7/”, line 194, in compile
File “/usr/lib/python2.7/”, line 251, in _compile
sre_constants.error: unknown specifier: ?P&

You can use the dmesg-command from entware.
The dmesg from busybox /usr/bin/dmesg) does not support the -T flag.

Do in a ssh-shell:

opkg install dmesg

This installs dmesg in /opt/bin/dmesg and -T is supported.

If it is a new entware-installation you have perhaps to logout and login again
to refresh your search-PATH

Hope that helps.


1 Like

Thanks, works like a dream.