I recently had some trouble with a wireless card, and an online forum suggested searching dmesg with grep firmware. That helped, I was able to find the problem immediately! However, the previous hour was spent looking at dmesg and I couldn't identify anything relevant due to the overwhelming quantity of information!

How does on know what to grep for in dmesg?

Sure, this was a hardware issue but I myself would never have thought to grep for the string "firmware". For someone not intimately familiar with the output of dmesg, how might I make some educated guesses about what to grep for?

  • 3
    I'm afraid that this question is not answerable as is. There're thousands of various stuff you can look for.
    – yo'
    Aug 11, 2014 at 16:17
  • 3
    Thousands, yes, but surely there may be some guidelines. There are thousands of words in English, but there are guidelines on how to google a problem!
    – dotancohen
    Aug 11, 2014 at 16:23
  • @dotancohen Can you please elaborate on the issue with the card? Also, you can try lspci -vnn | grep -i net taken from this answer in super user
    – Simply_Me
    Aug 11, 2014 at 16:40
  • It seems that what you are looking for is some sort of documentation on the output of dmesg. Is this correct? Aug 11, 2014 at 17:07
  • 1
    Take a look at this maybe. The question of which lexicon is used with messages in the logs is related. You can explore it!
    – user44370
    Aug 11, 2014 at 18:55

1 Answer 1


Something like this would be useful:

dmesg | grep -iC 3 "what you are looking for" 

For example, if looking for your video card, you could try:

dmesg | grep -iC 3 "video"


dmesg | grep -iC 3 "graphics" 

The C 3 flag will print 3 lines before and after the matched string, just to give you some context on what the results are. But as @tohecz said, there are thousands of possibilities.

All depends on what you are looking for... sound, wifi, usb, serial, reader....

If you expect a usb key to appear in there, you can try grepping for /dev/sd.

Just found this page, that contains sound advice on how to grep stuff in there:

Because 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. 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 following command lists all references to USB (universal serial bus) devices in the kernel messages:

dmesg | grep -i usb

And the 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 following command checks to confirm that the HDD(s) is running in DMA (direct memory access) mode:

dmesg | grep -i dma
  • Nice idea. In fact I am familiar with the C flag.
    – dotancohen
    Aug 11, 2014 at 16:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .