Back to the command reference

dmesg

SystemFundamentals In simulator In real Linux

Show kernel messages (hardware, drivers)

Name: dmesg = display (driver) messages

You can practise it right away in the simulator, and use it in real Linux mode too.

Description

dmesg prints the kernel ring buffer: boot-time hardware detection, driver loading, USB plug events, disk errors and so on. It is the first place to look when hardware misbehaves.

Syntax

dmesg [OPTION]...

Common options

-T / --ctimeHuman-readable timestamps
-H / --humanReadable output (colours, relative times, paged)
-w / --followWait for new messages
-l errErrors only
-k / --kernelKernel messages only
-x / --decodeShow each message’s facility and level
-C / --clearClear the kernel message buffer (needs root)

Examples

  • $ sudo dmesg -T | tail

    Latest kernel messages

    Explain
  • $ dmesg | grep -i usb

    Check a USB device after plugging it in

    Explain

Related