用途
显示系统自检信息和设备信息
用法
dmesg [-c] [-r] [-n level] [-s bufsize]
常用选项
选项 | 含义 | 说明 |
---|---|---|
-c | 输出ring buffer内容并且清空ring buffer内容 | 第二次查看内容没有了,重新启动系统会重新生成 |
-r | 输出ring buffer原始内容 | 例如:显示日志等级前缀等 |
-s bufsize | 设置查询内核环缓存区大小 | 默认是16392,正好是内核环缓冲区的大小,如果比内核环缓冲区大,可以查看整个内容 |
-n level | 设置记录信息的等级 | Set the level at which logging of messages is done to the console. For example, -n 1 prevents all messages, except panic messages, from appearing on the console. All levels of messages are still written to /proc/kmsg, so syslogd(8) can still be used to control exactly where kernel messages appear. When the -n option is used, dmesg will not print or clear the kernel ring buffer. |
参考资料
【1】man dmesg
【2】linux dmesg命令参数及用法详解(linux显示开机信息命令)
https://blog.csdn.net/zhongyhc/article/details/8909905
【3】环形缓冲区的实现原理(ring buffer)
https://wenku.baidu.com/view/46bc49f37c1cfad6195fa75f.html
【4】无锁ring-buffer实现原理
https://www.jianshu.com/p/29b22d6ecee0
【5】linux dmesg命令参数及用法详解--linux显示开机信息命令
http://www.linuxso.com/command/dmesg.html