Using dmesg for Kernel Information

On a Linux dedicated server, the kernel is the single most important component of the operating system. It controls the OS’s interaction with hardware and handles all primary functions. If something is going wrong with your server at the OS level, the kernel is one place you should investigate.

The command dmesg is a simple Linux command that prints the message buffer of the kernel. Most of those messages are logged during the system boot sequence, but major events that occur after boot may also display kernel messages. Not all messages are cause for concern. In fact, most are good, or at least harmless. Others are simply warnings, and a few may be actual errors.

To run dmesg, simply type “dmesg” from the command line. The entire printout will usually be long, so you will need to use a text manipulation tool to view the entire log. For example:

dmesg | less
or
dmesg | more
or
tail -f /var/log/dmesg (to print out the latest messages only)

You can also save the contents of the dmesg printout to a file in your current directory with the following command string:

dmesg > kernel-messages.txt

There are many other system logs and information tools you can use to troubleshoot, but dmesg is a good way to quickly rule out major kernel problems. To find out more about dmesg, type “man dmesg” from the command line.











Comments: