dmesg command displays the messages from the kernel ring buffer. A system passes multiple runlevel from where we can get lot of information like system architecture, CPU, attached device, RAM etc. When computer boots up, a kernel (core of an operating system) is loaded into memory. During that period number of messages are being displayed where we can see hardware devices detected by kernel.
The messages are very important for diagnosing cases of device failure. When we connect or disconnect hardware device on the system, with the help of dmesg command, we can understand this rapid stream of info information on the fly.