dmesg命令手册
dmesg:显示开机信息
使用dmesg命令可以显示系统开机启动信息。
内核会将开机启动信息存储在 ring buffer(环形缓冲区)中。您若是开机时来不及查看信息,可利用dmesg命令来查看。开机信息保存在 /var/log/dmesg 日志文件里。某些硬件设备在安装时,通常会安装驱动程序(内核模块),会打印一些信息,也可以通过dmesg命令来查看。
命令语法
dmesg [选项]
选项含义
命令中各选项的含义如下表所示。
选项 | 含义 |
---|---|
-c | 显示信息后,清除环形缓冲区中的内容 |
-n <等级> | 设置记录信息的等级 |
-r | 打印原始消息缓冲区 |
-s <缓冲区大小> | 默认为8196,刚好等于环形缓冲区的大小 |
参考实例
(1)显示系统开机启动信息
[root@cnLinuxer ~]# dmesg
(2)查看硬盘基础信息
[root@cnLinuxer ~]# dmesg | grep sda
[ 1.720139] sd 2:0:0:0: [sda] 209715200 512-byte logical blocks: (107 GB/100 GiB)
[ 1.720178] sd 2:0:0:0: [sda] Write Protect is off
[ 1.720181] sd 2:0:0:0: [sda] Mode Sense: 61 00 00 00
[ 1.720246] sd 2:0:0:0: [sda] Cache data unavailable
[ 1.720249] sd 2:0:0:0: [sda] Assuming drive cache: write through
[ 1.721667] sda: sda1 sda2
[ 1.722119] sd 2:0:0:0: [sda] Attached SCSI disk
[ 3.871024] XFS (sda1): Mounting V5 Filesystem
[ 3.993830] XFS (sda1): Ending clean mount
(3)查看内存基础信息
[root@cnLinuxer ~]# dmesg | grep memory
[ 0.000000] Base memory trampoline at [ffff91c9c0098000] 98000 size 24576
[ 0.000000] Reserving 161MB of memory at 688MB for crashkernel (System RAM: 2047MB)
[ 0.000000] Early memory node ranges
[ 0.000000] PM: Registered nosave memory: [mem 0x0009e000-0x0009efff]
[ 0.000000] PM: Registered nosave memory: [mem 0x0009f000-0x0009ffff]
[ 0.000000] PM: Registered nosave memory: [mem 0x000a0000-0x000dbfff]
[ 0.000000] PM: Registered nosave memory: [mem 0x000dc000-0x000fffff]
[ 0.000000] PM: Registered nosave memory: [mem 0x7fee0000-0x7fefefff]
[ 0.000000] PM: Registered nosave memory: [mem 0x7feff000-0x7fefffff]
[ 0.000000] please try 'cgroup_disable=memory' option if you don't want memory cgroups
[ 0.149369] Initializing cgroup subsys memory
[ 0.851656] Freeing initrd memory: 21092k freed
[ 0.926515] Non-volatile memory driver v1.3
[ 0.927771] crash memory driver: version 1.1
[ 0.953251] Freeing unused kernel memory: 1980k freed
[ 0.954907] Freeing unused kernel memory: 396k freed
[ 0.956232] Freeing unused kernel memory: 540k freed
[ 1.617861] [drm] Max dedicated hypervisor surface memory is 0 kiB
[ 1.617862] [drm] Maximum display memory size is 131072 kiB
[ 1.617976] [TTM] Zone kernel: Available graphics memory: 931520 kiB
[root@cnLinuxer ~]#
(4)清空dmesg环形缓冲区中的日志
[root@cnLinuxer ~]# dmesg -c
有收获,点个在看
评论