在Linux系统中,命令dmesg 用于显示内核环形缓冲区(kernel-ring buffer)的内容。在进行系统引导时,内核会将硬件和模块初始化相关信息的信息写到这个缓冲区中,内核环形缓冲区中的消息对于诊断系统问题非常有用。
内核环形缓冲区的内容同时会保存在/var/logm目录中,即名为dmesg的文件里。可通过如下命令进行查看:
[root@test ~]# ll -h /var/log/dmesg
-rw-r--r--. 1 root root 121K Jul 21 23:27 /var/log/dmesg
[root@test ~]#
语法:
dmesg [选项]
参数说明:
-c 显示信息后,清除环形缓冲区中的内容
-s bufsize 设置缓冲区大小,默认16384(2.1.113内核或更高)
-n level 显示消息等级
案例:
查看内核环形缓冲区(less命令作用是将信息分页显示)
[root@test ~]# dmesg | less
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuat
[ 0.000000] Linux version 3.10.0-1062.el7.x86_64 (mockbuild@kbuilder.bsys.centos.) (g version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Wed Aug 7 18:08:02 UTC 2019
[ 0.000000] Command line: BOOT_IMAGE=/vmlinuz-3.10.0-1062.el7.x86_64 root=/dev/mapper/centos-root ro crashkernel=auto spectre_v2=retpoline rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet LANG=en_US.UTF-8
[ 0.000000] Disabled fast string operations
[ 0.000000] e820: BIOS-provided physical RAM map:
[ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009ebff] usable
[ 0.000000] BIOS-e820: [mem 0x000000000009ec00-0x000000000009ffff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000000dc000-0x00000000000fffff] reserved
[ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000007fedffff] usable
[ 0.000000] BIOS-e820: [mem 0x000000007fee0000-0x000000007fefefff] ACPI data
[ 0.000000] BIOS-e820: [mem 0x000000007feff000-0x000000007fefffff] ACPI NVS
[ 0.000000] BIOS-e820: [mem 0x000000007ff00000-0x000000007fffffff] usable
[ 0.000000] BIOS-e820: [mem 0x00000000f0000000-0x00000000f7ffffff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000fec00000-0x00000000fec0ffff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved
[ 0.000000] BIOS-e820: [mem 0x00000000fffe0000-0x00000000ffffffff] reserved
[ 0.000000] NX (Execute Disable) protection: active
[ 0.000000] SMBIOS 2.7 present.
[ 0.000000] DMI: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 04/13/2018
[ 0.000000] Hypervisor detected: VMware
[ 0.000000] vmware: TSC freq read from hypervisor : 2904.007 MHz
[ 0.000000] vmware: Host bus clock speed read from hypervisor : 66000000 Hz
[ 0.000000] vmware: using sched offset of 7752161154 ns
[ 0.000000] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
[ 0.000000] e820: remove [mem 0x000a0000-0x000fffff] usable
:
更多推荐
命令,详细,Linux,dmesg
发布评论