dmesg(1)
Print or control the kernel ring buffer messages.
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
| Flag | What it does |
|---|---|
-c | Clear the ring buffer after printing (requires root) |
-C | Clear the ring buffer without printing |
-l | Keep log levels in output (don't strip facility/severity) |
-r | Print raw message buffer contents exactly as kernel sends them |
-T | Print human-readable timestamps for each line |
-t | Print only the message text, without log level prefix |
-L | Colorize output for log levels (for terminals) |
-S seqnum | Print messages starting from a specific sequence number |
-n level | Set console logging level (0-8, higher=more verbose) |
--since TIME | Print only messages since specified time (e.g., '1 hour ago') |
--until TIME | Print only messages until specified time |
Examples
View the entire kernel ring buffer with pagination to scroll through boot messages and hardware detection
dmesg | lessShow the last 20 kernel messages (most recent activity)
dmesg | tail -20Search for all USB-related kernel messages to debug USB device issues
dmesg | grep -i usbDisplay the last 50 messages with human-readable timestamps to see when they occurred
dmesg -T | tail -50Print all current kernel messages and clear the ring buffer (useful after troubleshooting)
sudo dmesg -cFind all error and warning messages in the kernel log
dmesg | grep -E 'error|warning|failed' -iShow 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