dmesg to find usb key in Linux?

7,735

Try this:

tail -f /var/log/dmesg

This will output the contents of dmesg as it happens. While you have this running, plug your USB memory stick in and note what it says. If you get heaps of non-related stuff, try this:

tail -f /var/log/dmesg | grep USB

This will only show lines containing the word USB. Use Ctrl + C to exit.

There is another answer here to a related question.

Share:
7,735

Related videos on Youtube

vuejs
Author by

vuejs

Updated on September 18, 2022

Comments

  • vuejs
    vuejs over 1 year

    What exactly I must look for after a dmesg comand to find usb key? there are lots of entries with usb in them but which one?

    • don_crissti
      don_crissti about 7 years
      What are you trying to accomplish ?
    • vuejs
      vuejs about 7 years
      I need the device nameof my usb so I can install Debian on it.
    • don_crissti
      don_crissti about 7 years
      ... run lsblk -no name,label,tran before and after inserting your key
    • vuejs
      vuejs about 7 years
      @don_crissti lsblk worked, thanks, just need to see where it is in dmesg.
  • dirkt
    dirkt about 7 years
    Note however that grepping will remove all context that doesn't contain the word USB (in caps), and often this context is important. Once you've identified the place where interesting things happen, always look at the complete dmesg output at the appropriate place. (less has a search function).
  • dirkt
    dirkt about 7 years
    Why use watch (executes every 2 seconds) instead of tail -f (executes when the output changes)?
  • GAD3R
    GAD3R about 7 years
    @dirkt You should be root to access the log file /var/log/
  • dirkt
    dirkt about 7 years
    So use sudo. You are doing admin work, you need root access, anyway.
  • Jacob Degeling
    Jacob Degeling about 7 years
    You are right: less is a much better way if you need to keep context information.