Have dmesg print human readable time

8.1k views Asked by At

I would like dmesg to print human readable date times without passing the -T parameter. Is there a way to do this without setting up an alias? In config files maybe?

dmesg output:

# dmesg | tail -1
[    6.639729] IPv6: enp03: link becomes ready

in this case I would like dmesg to print:

# dmesg | tail -1
[Fri Sep 15 08:15:29 2017] IPv6: enp03: link becomes ready
1

There are 1 answers

0
Armali On

I would like dmesg to print human readable date times without passing the -T parameter. Is there a way to do this without setting up an alias?

If you don't want an alias, which would usually be the best choice, you could place a script in a directory which is in PATH before /bin (if the real dmesg is /bin/dmesg), e. g. ~/bin/dmesg:

exec /bin/dmesg -T "$@"

Don't forget to chmod +x.