dmesg

Linux · System · reference only

What it does

Shows the kernel message buffer: boot, hardware detection, drivers and system errors.

Syntax

dmesg [opciones]

Options and parameters

  • -T

    Shows timestamps as readable date and time.

  • -w

    Waits and shows new messages as they arrive.

  • -l niveles

    Shows only those levels, such as err or err,warn.

  • -H

    Human-friendly format, with colors and paging.

  • -c

    Shows the messages and then clears the buffer (requires root).

  • -x

    Shows each message's origin and level in readable form.

  • -k

    Shows only kernel messages.

Usage examples

  • sudo dmesg | tail

    Shows the latest kernel messages.

  • sudo dmesg -T | grep -i usb

    Looks for USB events with the real time.

  • sudo dmesg -l err,warn

    Shows only errors and warnings.

  • sudo dmesg -w

    Follows messages live while you plug in a device.

Notes and common mistakes

  • Some distributions restrict dmesg to root through kernel.dmesg_restrict.
  • The buffer has a limited size: old messages are lost.

Related commands