Hi, this is Sandra Henry-Stocker, author of the “Unix as a Second Language” blog on NetworkWorld.
In this Linux tip, we’re going to look at the dmesg command. It’s a command that displays the content of the kernel message buffer – messages that were sent by various system services such as device drivers. You can view a lot of information that you would normally not see and get insights into how your system is working.
To see the content of the kernel message buffer, you can just type dmesg, but let’s use more so we can take a closer look at some of the details.
Notice that the lines all begin with [ .000000]. This is actually a time field. It shows the number of seconds and nanoseconds since the system was last rebooted. Many messages are generated when a system boots.
Moving on, we can see the number of nanoseconds increasing. A more useful view is to use the -T option to show this field in a date/time format like this:
$ dmesg -T | more
As you see, we can clear see lots of date/time info, much of which was added to the buffer at boot time. You can also look for specific messages – like those generated by the kernel itself or daemon processes with commands like these:
$ dmesg -Tk | head -4
$ dmesg -Tf daemon | head -4
To understand the many ways you can use the dmesg command, you should take a look at the help page like this:
$ dmesg –help
There are a lot of ways that you can dig into dmesg output and gain insight into how your system is working. Figuring out what you want to see may take some time. A command like this will display emergency level messages. No output means none were generated.
$ dmesg -Tl emerg
That’s your Linux tip for the dmesg command.
If you have questions or would like to suggest a topic, please add a comment below. And don’t forget to subscribe to the IDG Tech(talk) channel on YouTube.
If you liked this video, please hit the like and share buttons. For more Linux tips, be sure to follow us on Facebook, YouTube and NetworkWorld.com.
previous post