How to figure out if a disk is USB or not on Linux

tags: shell linux

It is surprisingly difficult to know if a disk connected to a running Linux system is a USB disk or not. The command that finally worked for me was lsblk -do name,tran, which looked like this:

$ lsblk -do name,tran
NAME   TRAN
loop0
loop1
loop2
loop3
loop4
loop5
loop6
loop7
loop8
loop9
loop10
loop11
loop12
loop13
sda    sata
sdb    sata
sdc    usb

(Of course there's 14 bogus loopback devices that seemingly do nothing, that's just how things work, right?)

Things that did not work for me: