dmesg Command: Tutorial & Examples

Display the kernel's message buffer

The dmesg command is a utility that is used to display the kernel message buffer, which contains messages that are generated by the Linux kernel and various kernel-level drivers. These messages can include information about system events, such as hardware detection, system initialization, and driver loading, as well as error messages and other diagnostic information.

To view the kernel message buffer, you can use the dmesg command with no arguments:


This will display the entire message buffer, which may be quite long. You can use the less or more command to view the output one screen at a time:

dmesg | less
dmesg | more

You can also use the grep command to search for specific messages within the buffer:

dmesg | grep "error"

This will search for all lines in the message buffer that contain the word "error".

The dmesg command can be useful for troubleshooting problems on a Linux system, as it can provide valuable information about what is happening at the kernel level. It is especially useful for diagnosing issues with hardware, drivers, and other low-level system components.

Except where otherwise noted, content on this site is licensed under a CC BY-SA 4.0 license CC BY SA