I would like to list only the USB storage devices connected to my computer. Since these are SCSI disks, I used the command lsscsi
, which lists the USB drives as well as my computer's hard drive and CD drive. Is there a way to ignore the memory storage that's not a USB? I have also tried lsusb
, but this includes my keyboard, mouse, and other non-storage devices.
Linux – a Linux command that lists only USB storage devices
command linelinuxscsiusb
Best Answer
This answer checks the list of all attached block devices and iterates over them with
udevadmin
to check their respectiveID_BUS
.You can see all attached block devices in
/sys/block
. Here is the bash script from the linked answer that should let you know if it is a USB storage device: