Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
How to detect an USB device?

I would like to list ONLY devices connected via usb.

The problem is that Ubuntu seems to see all thumb drives as removable (in /sys/block/*/removable), but it does not see external hard drives the same way.

share|improve this question

marked as duplicate by Amith KK, Anwar Shah, jokerdino, Mitch, Eliah Kagan Jul 31 '12 at 3:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

I'd recommend checking the udev properties of the devices, specifically the ID_BUS property:

for device in /sys/block/*
    if udevadm info --query=property --path=$device | grep -q ^ID_BUS=usb
        echo $device
share|improve this answer
This is perfect! Thanks! – user1556438 Jul 28 '12 at 2:41
@user1556438: if this answers your question, please select it as the correct anwser, by clicking the check mark on the left. – Jeremy Kerr Jul 28 '12 at 5:01

If you are looking for the mounted disks, a simple


will list them along with all your other disks along with some useful info.

share|improve this answer

I think


will give you what you want, at least if I understand what you're asking. (Of course, it lists all usb devices, not just storage.)

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.