linux命令(四):分析开机内核信息 dmesg

dmesg

dmesg命令用于打印Linux系统开机启动信息,kernel会将开机信息存储在ring buffer中。您若是开机时来不及查看信息,可利用dmesg来查看(print or control the kernel ring buffer)。开机信息亦保存在/var/log/dmesg的文件里。某些硬件设备在安装的时候,通常会安装驱动程序(内核模块),会打印一些信息,就可以通过dmesg命令来查看。由于dmesg产生的信息比较多,可以结合grep/more/less/tail 等命令一起使用

例子:

(1)  dmesg   直接查看开机信息

(2) dmesg  -c    清除环形缓存区,但/var/log/dmesg文件中仍然有这些信息。

(3)     dmesg | grep DMA     检查硬盘是否运行在DMA模式,可以用在当发现硬盘性能低下时候检查

(4) dmesg | grep eth   当以太网连接有问题时候可以使用他查看,如果一切正常,那么dmesg显示每个网卡的硬件配置信息。如果某项系统服务未能得到正确的配置,dmesg日志很快就填满错误消息,这是诊断故障的良好起点

[root@localhost grub]# dmesg | grep eth0
e1000e 0000:05:00.0: eth0: (PCI Express:2.5GT/s:Width x1) 74:d0:2b:99:c0:e2
e1000e 0000:05:00.0: eth0: Intel(R) PRO/1000 Network Connection
e1000e 0000:05:00.0: eth0: MAC: 3, PHY: 8, PBA No: FFFFFF-0FF
ADDRCONF(NETDEV_UP): eth0: link is not ready
e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx
ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
8021q: adding VLAN 0 to HW filter on device eth0
eth0: no IPv6 routers present
(5)探测系统内核模块的加载情况,比如要检测pcie的加载情况  

[root@localhost grub]# dmesg |  grep -i pcie
ACPI FADT declares the system doesn't support PCIe ASPM, so disable it
pcieport 0000:00:01.0: setting latency timer to 64
pcieport 0000:00:01.0: irq 54 for MSI/MSI-X
pcieport 0000:00:02.0: setting latency timer to 64
pcieport 0000:00:02.0: irq 55 for MSI/MSI-X
pcieport 0000:00:03.0: setting latency timer to 64
pcieport 0000:00:03.0: irq 56 for MSI/MSI-X
pcieport 0000:00:11.0: setting latency timer to 64
pcieport 0000:00:11.0: irq 57 for MSI/MSI-X
pcieport 0000:00:1c.0: setting latency timer to 64
pcieport 0000:00:1c.0: irq 58 for MSI/MSI-X
pcieport 0000:00:1c.1: setting latency timer to 64
pcieport 0000:00:1c.1: irq 59 for MSI/MSI-X
pcieport 0000:00:1c.2: setting latency timer to 64
pcieport 0000:00:1c.2: irq 60 for MSI/MSI-X
pcieport 0000:00:1c.3: setting latency timer to 64
pcieport 0000:00:1c.3: irq 61 for MSI/MSI-X
pciehp: PCI Express Hot Plug Controller Driver version: 0.4
(6) dmesg | less

(7) dmesg |  tail  查看尾部信息

(8)当安装某些硬件设备驱动时候,例如安装SS7卡驱动时的内核日志, 你install,lsmod后 可以使用dmesg查看安装该卡驱动的过程信息

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值