dmesg flags & options

Basic usage

Print all kernel messages.

dmesg

-T, --ctime

Show human-readable timestamps.

dmesg -T

-w, --follow

Follow new messages in real time (like tail -f).

dmesg -w
dmesg -Tw

-l, --level

Filter by log level: emerg, alert, crit, err, warn, notice, info, debug.

dmesg -l err,warn
dmesg -l crit

-f, --facility

Filter by facility: kern, user, daemon, auth, syslog, etc.

dmesg -f kern

-H, --human

Human-readable output with colors and timestamps.

dmesg -H

--color

Force colorized output.

dmesg --color=always | less -R

-c, --read-clear

Print and clear the ring buffer (requires root).

sudo dmesg -c

Search for specific messages

dmesg | grep -i usb
dmesg -T | grep -i error