Pipe to less but keep the highlighting

Solution 1:

Use the --human parameter to view colored dmesg output in a less-like environment.

dmesg --human --color=always

Or use the short version:

dmesg -H

Alternatively, use the following command to achieve similar results.

dmesg --color=always | less -R

Many other utilities that produce colored output (ls, grep, etc.) have a similar --color=always option.