I am in ubuntu, when I write dmesg the error messages appear in red, how could I print in the console only those?
use --level
option described in man dmesg
:
-l, --level list Restrict output to the given (comma-separated) list of levels. For example: dmesg --level=err,warn will print error and warning messages only. For all supported levels see the --help output.