码迷,mamicode.com
首页 > 系统相关 > 详细

Linux 命令小记:dmesg命令

时间:2020-06-16 12:49:41      阅读:83      评论:0      收藏:0      [点我收藏+]

标签:gis   att   com   str   number   order   tac   系统   inux   

dmesg 命令可显示系统开机信息,一般用于故障排查和设备/驱动的加载的查询。

 

在日常工作中,dmesg 命令曾被用于查看硬盘加载状况:

root@ubuntu:~/Desktop# dmesg | grep sda
[    3.791441] sd 32:0:0:0: [sda] 83886080 512-byte logical blocks: (42.9 GB/40.0 GiB)
[    3.791536] sd 32:0:0:0: [sda] Write Protect is off
[    3.791539] sd 32:0:0:0: [sda] Mode Sense: 61 00 00 00
[    3.791740] sd 32:0:0:0: [sda] Cache data unavailable
[    3.791742] sd 32:0:0:0: [sda] Assuming drive cache: write through
[    3.792287] sd 32:0:0:0: [sda] Cache data unavailable
[    3.792289] sd 32:0:0:0: [sda] Assuming drive cache: write through
[    3.869834]  sda: sda1 sda2 < sda5 >
[    3.877637] sd 32:0:0:0: [sda] Cache data unavailable
[    3.877641] sd 32:0:0:0: [sda] Assuming drive cache: write through
[    3.877644] sd 32:0:0:0: [sda] Attached SCSI disk
[    5.873666] EXT4-fs (sda1): INFO: recovery required on readonly filesystem
[    5.873670] EXT4-fs (sda1): write access will be enabled during recovery
[   17.943579] EXT4-fs (sda1): recovery complete
[   18.091471] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
[   48.693907] Adding 1046524k swap on /dev/sda5.  Priority:-1 extents:1 across:1046524k 
[   49.938769] EXT4-fs (sda1): re-mounted. Opts: errors=remount-ro

也可用于查看硬件加载情况,比如查看 can 口的接入情况:

# dmesg | grep can
[605149.652926] c_can_platform 481cc000.d_can can0: setting BTR=1c05 BRPE=0000
[614575.355562] c_can_platform 481cc000.d_can can0: setting BTR=1c05 BRPE=0000
[634483.860545] c_can_platform 481cc000.d_can can0: setting BTR=1c05 BRPE=0000

查看 usb 接入情况:

root@ubuntu:~/桌面# dmesg | grep usb
[    2.268915] usbcore: registered new interface driver usbfs
[    2.268951] usbcore: registered new interface driver hub
[    2.269264] usbcore: registered new device driver usb
[    2.912961] usbcore: registered new interface driver libusual
[    3.222047] usb 2-1: new full-speed USB device number 2 using uhci_hcd
[    3.488637] usb 2-2: new full-speed USB device number 3 using uhci_hcd

因此 dmesg 命令是一个检测系统设备接入状态、排查系统故障的很方便的命令工具。

 

若需要查看所有信息,可执行

dmesg > dmesg.txt

将命令打印信息保存成 dmesg.txt 文件供查阅。

Linux 命令小记:dmesg命令

标签:gis   att   com   str   number   order   tac   系统   inux   

原文地址:https://www.cnblogs.com/yqmcu/p/13140088.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!