Categories
Linux Tutorial Series

Linux Tutorial Series – 154 – Viewing kernel messages

Here is the video version, if you prefer it:

The dmesg command is used to display kernel messages. (Ward, 2014)⁠ You use this command when you want to see if a kernel is giving you an error for a particular hardware device, for example.

An example:

mislav@mislavovo-racunalo:~/Linux_folder$ sudo dmesg

[2344706.157876] x86: Booting SMP configuration:

[2344706.157877] smpboot: Booting Node 0 Processor 1 APIC 0x2

[2344706.158274] cache: parent cpu1 should not be sleeping

[2344706.158419] CPU1 is up

[2344706.158436] smpboot: Booting Node 0 Processor 2 APIC 0x4

[2344706.158833] cache: parent cpu2 should not be sleeping

[2344706.158987] CPU2 is up

dmesg gives a lot of output, so be prepared. You can pipe it and use less to read through it, for example, or redirect its output in a file.

Another way to look at kernel messages (besides dmesg) is by looking at the contents of a file which is located in /var/log/kern.log. (Ward, 2014)⁠ Keep in mind that catting this file will produce a lot of output.

Thank you for reading!

References

Ward, B. (2014). How Linux Works: What Every Superuser Should Know (2nd ed.). No Starch Press. Pages 94-95