Linux – Explain the output of dmesg

debiandmesglinuxsyslog

I am running a Debian system, and find the output of the dmesg command very helpful.

Can somebody explain to me what information is output by the dmesg command? Is it a 1:1 correlation to the kern.* messages in syslog?

Best Answer

Technically speaking dmesg prints the kernel ring buffer to standard output.

I don't know why they call it the ring buffer, but it's basically a log buffer. All of the kernel boot messages get written there. If you are running syslog then all, or most, of these messages will also probably be written to there as well. However, the dmesg command is seperate from syslog. It is part of linux utils, and you can use it even if you do not have syslog.

dmesg can also be used to clear the ring buffer itself, and also to change the level at which errors show up in console. Sometimes, depending on the seriousness of a message, it will be sent to every console in addition to the ring buffer. A good example of this is a shutdown message. dmesg -n levelnumber allows you to change the level of seriousness a message must have to be sent to the consoles in addition to the buffer.