Table of Contents

dmesg : How to use dmesg command in Linux with examples



man date

# man dmesg
NAME
       dmesg - print or control the kernel ring buffer

       -H, --human
              Enable human-readable output.  See also --color, --reltime and --nopager.

       -P, --nopager
              Do not pipe output into a pager.  A pager is enabled by default for --human output.

       -T, --ctime
              Print human-readable timestamps.
# dmesg -h
Usage:
 dmesg [options]

Display or control the kernel ring buffer.

Options:
 -H, --human                 human readable output
 -P, --nopager               do not pipe output into a pager
 -T, --ctime                 show human-readable timestamp (may be inaccurate!)

 -h, --help                  display this help
 -V, --version               display version


deesg Examples

dmesg

# dmesg
[    0.000000] Linux version 5.4.0-65-generic (buildd@lcy01-amd64-018) (gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20
.04)) #73-Ubuntu SMP Mon Jan 18 17:25:17 UTC 2021 (Ubuntu 5.4.0-65.73-generic 5.4.78)
[    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.4.0-65-generic root=UUID=0806b4be-e97e-471a-8d1d-a1f29e2c428
0 ro console=tty0 console=ttyS0,115200n8 net.ifnames=0 biosdevname=0 maybe-ubiquity
[    0.000000] KERNEL supported cpus:
[    0.000000]   Intel GenuineIntel
[    0.000000]   AMD AuthenticAMD
[    0.000000]   Hygon HygonGenuine
[    0.000000]   Centaur CentaurHauls
[    0.000000]   zhaoxin   Shanghai
[    0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
[    0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
[    0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
[    0.000000] x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256
[    0.000000] x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format.
[    0.000000] BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[    0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000003fffdfff] usable
[    0.000000] BIOS-e820: [mem 0x000000003fffe000-0x000000003fffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
[    0.000000] NX (Execute Disable) protection: active
[    0.000000] SMBIOS 2.4 present.
[    0.000000] DMI: Fedora Project OpenStack Nova, BIOS 0.5.1 01/01/2011
[    0.000000] Hypervisor detected: KVM
[    0.000000] kvm-clock: Using msrs 4b564d01 and 4b564d00
[    0.000000] kvm-clock: cpu 0, msr 2a001001, primary cpu clock
[    0.000000] kvm-clock: using sched offset of 336950726489632 cycles


dmesg -H (-H = --human)

 -H, --human                 human readable output
# dmesg -H
[Feb16 23:15] Linux version 5.4.0-65-generic (buildd@lcy01-amd64-018) (gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20>
[  +0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.4.0-65-generic root=UUID=0806b4be-e97e-471a-8d1d-a1f29e2c428>
[  +0.000000] KERNEL supported cpus:
[  +0.000000]   Intel GenuineIntel
[  +0.000000]   AMD AuthenticAMD
[  +0.000000]   Hygon HygonGenuine
[  +0.000000]   Centaur CentaurHauls
[  +0.000000]   zhaoxin   Shanghai
[  +0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
[  +0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
[  +0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
[  +0.000000] x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256
[  +0.000000] x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format.
[  +0.000000] BIOS-provided physical RAM map:
[  +0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[  +0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
[  +0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[  +0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000003fffdfff] usable
[  +0.000000] BIOS-e820: [mem 0x000000003fffe000-0x000000003fffffff] reserved
[  +0.000000] BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff] reserved
[  +0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
[  +0.000000] NX (Execute Disable) protection: active
[  +0.000000] SMBIOS 2.4 present.
[  +0.000000] DMI: Fedora Project OpenStack Nova, BIOS 0.5.1 01/01/2011
[  +0.000000] Hypervisor detected: KVM
[  +0.000000] kvm-clock: Using msrs 4b564d01 and 4b564d00
[  +0.000000] kvm-clock: cpu 0, msr 2a001001, primary cpu clock
[  +0.000000] kvm-clock: using sched offset of 336950726489632 cycles


dmesg -T (-T = --ctime)

 -T, --ctime                 show human-readable timestamp (may be inaccurate!)

The dmesg time is incorrect.
Timestamps are slowed down because the time the kernel was asleep is lost.

# dmesg -T
[Tue Feb 16 23:15:10 2021] Linux version 5.4.0-65-generic (buildd@lcy01-amd64-018) (gcc version 9.3.0 (Ubuntu 9.3.0-
17ubuntu1~20.04)) #73-Ubuntu SMP Mon Jan 18 17:25:17 UTC 2021 (Ubuntu 5.4.0-65.73-generic 5.4.78)
[Tue Feb 16 23:15:10 2021] Command line: BOOT_IMAGE=/boot/vmlinuz-5.4.0-65-generic root=UUID=0806b4be-e97e-471a-8d1d
-a1f29e2c4280 ro console=tty0 console=ttyS0,115200n8 net.ifnames=0 biosdevname=0 maybe-ubiquity
[Tue Feb 16 23:15:10 2021] KERNEL supported cpus:
[Tue Feb 16 23:15:10 2021]   Intel GenuineIntel
[Tue Feb 16 23:15:10 2021]   AMD AuthenticAMD
[Tue Feb 16 23:15:10 2021]   Hygon HygonGenuine
[Tue Feb 16 23:15:10 2021]   Centaur CentaurHauls
[Tue Feb 16 23:15:10 2021]   zhaoxin   Shanghai
[Tue Feb 16 23:15:10 2021] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
[Tue Feb 16 23:15:10 2021] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers'
[Tue Feb 16 23:15:10 2021] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers'
[Tue Feb 16 23:15:10 2021] x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256
[Tue Feb 16 23:15:10 2021] x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format.
[Tue Feb 16 23:15:10 2021] BIOS-provided physical RAM map:
[Tue Feb 16 23:15:10 2021] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[Tue Feb 16 23:15:10 2021] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
[Tue Feb 16 23:15:10 2021] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[Tue Feb 16 23:15:10 2021] BIOS-e820: [mem 0x0000000000100000-0x000000003fffdfff] usable
[Tue Feb 16 23:15:10 2021] BIOS-e820: [mem 0x000000003fffe000-0x000000003fffffff] reserved
[Tue Feb 16 23:15:10 2021] BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff] reserved
[Tue Feb 16 23:15:10 2021] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
[Tue Feb 16 23:15:10 2021] NX (Execute Disable) protection: active
[Tue Feb 16 23:15:10 2021] SMBIOS 2.4 present.
[Tue Feb 16 23:15:10 2021] DMI: Fedora Project OpenStack Nova, BIOS 0.5.1 01/01/2011
[Tue Feb 16 23:15:10 2021] Hypervisor detected: KVM
[Tue Feb 16 23:15:10 2021] kvm-clock: Using msrs 4b564d01 and 4b564d00
[Tue Feb 16 23:15:10 2021] kvm-clock: cpu 0, msr 2a001001, primary cpu clock
[Tue Feb 16 23:15:10 2021] kvm-clock: using sched offset of 336950726489632 cycles