The dmesg command provides kernel-related messages. While displaying the dmesg messages every message is displayed with a time stamp that is a number. The default dmesg timestamp just consists of numbers without any day, month, or year information. This makes the dmesg message hard to read for humans. There are ways to display dmesg timestamp in a human-readable format.
Print dmesg Message Human Readable Format
The dmesg command provides the -T
option in order to print human-readable timestamps.
$ sudo dmesg -T
Enable Timestamps
Generally, dmesg timestamps are displayed without any problem but if the timestamps are not displayed we can not also display the date and time information in a human-readable format. The dmesg command timestamp can be enabled and disabled via the /sys/module/printk/parameters/time
configuration. First, we check if the timestamp is disabled with this configuration.
$ cat /sys/module/printk/parameters/time
If the output is just N
this means the timestamp is disabled. We can enable the timestamp with the following command.
$ echo Y | sudo tee /sys/module/printk/parameters/time