Find external and internal devices attached to a system in Linux

How can I find through terminal which devices are external and which are internal?

By external I mean devices that are attached to a USB port. For Example, USB Drive, Portable USB hard drive etc.

By internal I mean devices attached internally. For Example, SATA hard disk etc.


In addition to checking dmesg output, you can also use the programs lshw, lspci, lsusb, and lshal to query various hardware subsystems to locate currently-attached devices.

On Debian and Debian-based distributions like Ubuntu, these are provided by the packages lshw, pciutils, usbutils, and hal, respectively.

Here's a sample of the output from lshw on my Debian system. I don't have any USB devices attached at present, but you can see each individual USB controller. Any attached USB devices would be shown under their parent controllers, in the same manner that the hard drive (/dev/hde) and CD drive (/dev/hdb) are shown.

$ sudo lshw -short
H/W path         Device     Class       Description
===================================================
                            system      To be Filled
/0                          bus         Intel 440BX/GX
/0/0                        memory      64KiB BIOS
/0/4                        processor   Pentium III (Katmai)
/0/4/6                      memory      32KiB L1 cache
/0/4/7                      memory      512KiB L2 cache
/0/5                        processor   Pentium III (Katmai)
/0/5/0                      memory      32KiB L1 cache
/0/5/1                      memory      512KiB L2 cache
/0/1                        memory      639MiB System memory
/0/100                      bridge      440BX/ZX/DX - 82443BX/ZX/DX Host bridge
/0/100/1                    bridge      440BX/ZX/DX - 82443BX/ZX/DX AGP bridge
/0/100/7                    bridge      82371AB/EB/MB PIIX4 ISA
/0/100/7.1                  storage     82371AB/EB/MB PIIX4 IDE
/0/100/7.1/0     ide0       bus         IDE Channel 0
/0/100/7.1/0/1   /dev/hdb   disk        TSST CDW/DVD TS-H492A
/0/100/7.1/1     ide1       bus         IDE Channel 1
/0/100/7.2                  bus         82371AB/EB/MB PIIX4 USB
/0/100/7.2/1     usb1       bus         UHCI Host Controller
/0/100/7.3                  bridge      82371AB/EB/MB PIIX4 ACPI
/0/100/10                   storage     20269
/0/100/10/2      ide2       bus         IDE Channel 0
/0/100/10/2/0    /dev/hde   disk        320GB ST3320620A
/0/100/12        eth0       network     LNE100TX
/0/100/13                   bus         VT82xxxxx UHCI USB 1.1 Controller
/0/100/13/1      usb2       bus         UHCI Host Controller
/0/100/13.1                 bus         VT82xxxxx UHCI USB 1.1 Controller
/0/100/13.1/1    usb3       bus         UHCI Host Controller
/0/100/13.2                 bus         USB 2.0
/0/100/13.2/1    usb4       bus         EHCI Host Controller

dmesg | more

Should be pretty self-explanitory