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
-TShows timestamps as readable date and time.
-wWaits and shows new messages as they arrive.
-l nivelesShows only those levels, such as err or err,warn.
-HHuman-friendly format, with colors and paging.
-cShows the messages and then clears the buffer (requires root).
-xShows each message's origin and level in readable form.
-kShows only kernel messages.
Usage examples
sudo dmesg | tailShows the latest kernel messages.
sudo dmesg -T | grep -i usbLooks for USB events with the real time.
sudo dmesg -l err,warnShows only errors and warnings.
sudo dmesg -wFollows 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.