Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
add comment

marked as duplicate by Minato Namikaze, 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.

3 Answers

If you are looking for the mounted disks, a simple

df

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

share|improve this answer
add comment

I think

lsusb

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
add comment

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

for device in /sys/block/*
do
    if udevadm info --query=property --path=$device | grep -q ^ID_BUS=usb
    then
        echo $device
    fi
done
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
add comment

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