如何过滤 dmesg 日志以仅查看错误

Fer*_*oao 9 logs dmesg

我在 ubuntu,当我写 dmesg 时,错误消息显示为红色,我怎么能在控制台中只打印那些?

seb*_*sth 14

使用中--level描述的选项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.
Run Code Online (Sandbox Code Playgroud)