dmesg

What is dmesg?

dmesg command is used to write the kernel messages to standard output.

Kernel is the core of the Operating System. The first part of the Operating System that is being loaded during the boot process is kernel.

Kernel controls virtually everything on the system. A numerous messages will be shown on the display screen as computer boots up. This messages show the hardware devices that the kernel detects and whether it is able to configure them or not.

How Does dmesg work?

Command dmesg obtains its data from the Kernel Ring Buffer. In general Buffer is a temporary amount of space associated with every device like hard disk; printer. A ring buffer is a buffer of fixed size for which any new data added to it overwrites the oldest data in it.

How to use dmesg?

Usage of dmesg:

dmesg [options]

Invoking dmesg without any of its options (which are rarely used) causes it to write all the kernel messages to standard output.

dmesg | less

Example, the following command lists all references to USB (universal serial bus) devices in the kernel messages:

dmesg | grep -i usb

Following tells dmesg to show all serial ports (which are represented by the string tty):

dmesg | grep -i tty

The dmesg and grep combination can also be used to show how much physical memory (i.e., RAM) is available on the system:

dmesg | grep -i memory

The output of dmesg is maintained in the log file /var/log/dmesg.

cat /var/log/dmesg | less.

Advertisement
Post a comment or leave a trackback: Trackback URL.

Trackbacks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.