

The following command checks to confirm that the HDD(s) is running in DMA (direct memory access) mode: The dmesg and grep combination can also be used to show how much physical memory (i.e., RAM) is available on the system:
Better than dmesh serial#
For example, the following command lists all references to USB (universal serial bus) devices in the kernel messages:Īnd the following tells dmesg to show all serial ports (which are represented by the string tty): The -i option can be used to tell grep to ignore the case (i.e., lower case or upper case) of the letters in the string. For example, the output could be redirected to a file named boot_messages using the output redirection operator (designated by a rightward facing angle bracket) as follows:īecause of the length of the output of dmesg, it can be convenient to pipe its output to grep, a filter which searches for any lines that contain the string (i.e., sequence of characters) following it. When a user encounters a problem with the system, it can be convenient to write the output of dmesg to a file and then send that file by e-mail to a system administrator or other knowledgeable person for assistance.

(The more command could have been used here instead of the less command however, less is newer than more and has additional functions, including the ability to return to previous pages of the output.) Less allows the output to be moved forward one screenful at a time by pressing the SPACE bar, backward by pressing the b key and removed by pressing the q key.

However, the output can be redirected to the less command through the use of a pipe (designated by the vertical bar character), thereby allowing the startup messages to be viewed one screenful at a time: This usually produces far too many lines to fit into the display screen all at once, and thus only the final messages are visible.

Invoking dmesg without any of its options (which are rarely used) causes it to write all the kernel messages to standard output. A ring buffer is a buffer of fixed size for which any new data added to it overwrites the oldest data in it.ĭmesg can be very useful when troubleshooting or just trying to obtain information about the hardware on a system. A buffer is a portion of a computer's memory that is set aside as a temporary holding place for data that is being sent to or received from an external device, such as a hard disk drive (HDD), printer or keyboard. The numerous messages generated by the kernel that appear on the display screen as a computer boots up show the hardware devices that the kernel detects and indicate whether it is able to configure them.ĭmesg obtains its data by reading the kernel ring buffer. It is the first part of the operating system that is loaded into memory when a computer boots up (i.e., starts up), and it controls virtually everything on a system. The dmesg command is used to write the kernel messages in Linux and other Unix-like operating systems to standard output (which by default is the display screen).Ī kernel is the core of an operating system.
Better than dmesh how to#
How to use the dmesg command - by The Linux Information Project (LINFO) LINFO
