首页  

linux之dmesg命令总结     所属分类 linux 浏览量 1252
dmesg 命令显示Linux内核的环形缓冲区信息,可以从中获得诸如系统架构、CPU、挂载的硬件,RAM等多个运行级别的大量的系统信息。
当计算机启动时,系统内核将会被加载到内存中。在加载的过程中会显示很多的信息,在这些信息中可以看到内核检测硬件设备
kernel会将开机信息存储在ring buffer中。开机时来不及查看信息,可利用dmesg来查看。
/var/log/dmesg 文件

通过less或grep使用管道查看dmesg的输出

如果发现硬盘性能低下,可以使用dmesg来检查是否运行在DMA模式 dmesg | grep DMA

可以用来查看系统内核模块的加载情况,比如要检测ACPI的加载情况 dmesg | grep acpi


dmesg -T   
-T 时间格式化
dmesg -T   |grep 'Out of memory: Kill process'
[四 9月 19 17:30:38 2019] Out of memory: Kill process 11892 (java) score 315 or sacrifice child
[四 9月 19 19:25:32 2019] Out of memory: Kill process 9596 (redis-server) score 426 or sacrifice child
[四 9月 19 19:27:10 2019] Out of memory: Kill process 9629 (redis-server) score 429 or sacrifice child


分页显示 dmesg信息
dmesg |less
查看尾部20条信息
dmesg|tail -20
显示sda 信息
dmesg|grep -i sda
-i 忽略大小写
实时监控 dmesg输出
tail -f /var/log/dmesg
或者
watch "dmesg|tail -20" 

每隔一秒执行一次uptime
watch -n 1 "uptime"

watch -n -d 1 "uptime"
-d或--differences   高亮显示变化的区域

-t 或-no-title  会关闭watch命令在顶部的时间间隔

上一篇     下一篇
2018年五十大喜感新闻

lucene知识点整理

linux ulimit命令总结

linux性能分析及调优

linux系统性能分析工具sar总结

linux监控工具之nmon