$linuxjunkies
>

dmesg(1)

Print or control the kernel ring buffer messages.

UbuntuDebianFedoraArch

Synopsis

dmesg [OPTIONS]

Description

dmesg displays the message buffer of the kernel. These messages contain information about hardware, drivers, and kernel events logged since boot. It's invaluable for debugging hardware issues, driver problems, and system errors.

The kernel ring buffer is a fixed-size circular buffer, so older messages are eventually overwritten. Messages are also typically written to system log files by the syslog daemon for permanent record.

Common options

FlagWhat it does
-cClear the ring buffer after printing (requires root)
-CClear the ring buffer without printing
-lKeep log levels in output (don't strip facility/severity)
-rPrint raw message buffer contents exactly as kernel sends them
-TPrint human-readable timestamps for each line
-tPrint only the message text, without log level prefix
-LColorize output for log levels (for terminals)
-S seqnumPrint messages starting from a specific sequence number
-n levelSet console logging level (0-8, higher=more verbose)
--since TIMEPrint only messages since specified time (e.g., '1 hour ago')
--until TIMEPrint only messages until specified time

Examples

View the entire kernel ring buffer with pagination to scroll through boot messages and hardware detection

dmesg | less

Show the last 20 kernel messages (most recent activity)

dmesg | tail -20

Search for all USB-related kernel messages to debug USB device issues

dmesg | grep -i usb

Display the last 50 messages with human-readable timestamps to see when they occurred

dmesg -T | tail -50

Print all current kernel messages and clear the ring buffer (useful after troubleshooting)

sudo dmesg -c

Find all error and warning messages in the kernel log

dmesg | grep -E 'error|warning|failed' -i

Show only kernel messages from the last 10 minutes

dmesg --since '10 minutes ago'

Filter messages related to specific filesystems during mount/unmount

dmesg | grep 'EXT4\|XFS' -i

Related commands