> For the complete documentation index, see [llms.txt](https://www.shellspells.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.shellspells.net/linux/system-ops/filesystem/connected-devices.md).

# Connected Devices

## <mark style="color:red;">All Commands</mark>

<table data-header-hidden data-full-width="true"><thead><tr><th width="473">Command</th><th>Description</th></tr></thead><tbody><tr><td><mark style="color:yellow;"><code>mount</code></mark></td><td>List Mounted Filesystems and Devices.</td></tr><tr><td><mark style="color:yellow;"><code>lsblk</code></mark></td><td>List Block Devices and Their Partitions.</td></tr><tr><td><mark style="color:yellow;"><code>lsusb</code></mark></td><td>List USB Devices and Hubs.</td></tr><tr><td><mark style="color:yellow;"><code>lspci</code></mark></td><td>List PCI Devices (Peripheral Component Interconnect).</td></tr><tr><td><mark style="color:yellow;"><code>lsscsi</code></mark></td><td>List SCSI Devices.</td></tr><tr><td><mark style="color:yellow;"><code>lsdev</code></mark></td><td>List All Devices (AIX).</td></tr><tr><td><mark style="color:yellow;"><code>fdisk -l</code></mark></td><td>List Partitions and Drives.</td></tr><tr><td><mark style="color:yellow;"><code>parted -l</code></mark></td><td>List Partitions and Drives (with more details).</td></tr><tr><td><mark style="color:yellow;"><code>dmesg -H</code></mark></td><td>Display Kernel Ring Buffer (includes device discovery messages).</td></tr><tr><td><mark style="color:yellow;"><code>udevadm info</code></mark></td><td>Display Information about Devices Managed by Udev.</td></tr><tr><td><mark style="color:yellow;"><code>udevadm monitor</code></mark></td><td>Monitor Udev Events for Device Changes.</td></tr><tr><td><mark style="color:yellow;"><code>ls /dev</code></mark></td><td>List Device Files in the /dev Directory.</td></tr><tr><td><mark style="color:yellow;"><code>lshal</code></mark></td><td>List HAL Devices (may need to be installed).</td></tr><tr><td><mark style="color:yellow;"><code>hwinfo --usb</code></mark></td><td>Display USB Device Information (may need to be installed).</td></tr><tr><td><mark style="color:yellow;"><code>cat /proc/scsi/scsi</code></mark></td><td>Display Information about SCSI Devices.</td></tr><tr><td><mark style="color:yellow;"><code>lspcmcia</code></mark></td><td>List PCMCIA Devices (for systems with PCMCIA support).</td></tr><tr><td><mark style="color:yellow;"><code>df -h</code></mark></td><td>Display Disk Usage and Free Space (includes mounted devices).</td></tr><tr><td><mark style="color:yellow;"><code>cat /proc/mounts</code></mark></td><td>List Mounted Filesystems (alternative method).</td></tr><tr><td><mark style="color:yellow;"><code>blkid</code></mark></td><td>Display Block Device Attributes, including UUIDs.</td></tr><tr><td><mark style="color:yellow;"><code>file -s /dev/&#x3C;device></code></mark></td><td>Identify the Filesystem on a Device.</td></tr><tr><td><mark style="color:yellow;"><code>cat /proc/partitions</code></mark></td><td>List Disk Partitions.</td></tr><tr><td><mark style="color:yellow;"><code>lsusb -t</code></mark></td><td>Display USB Device Tree.</td></tr><tr><td><mark style="color:yellow;"><code>ls -l /sys/class/block</code></mark></td><td>List Block Devices Using Sysfs.</td></tr><tr><td><mark style="color:yellow;"><code>usb-devices</code></mark></td><td>List USB Devices and Their Details (may need to be installed).</td></tr><tr><td><mark style="color:yellow;"><code>lspcmcia -v</code></mark></td><td>List PCMCIA Devices with Verbose Information.</td></tr><tr><td><mark style="color:yellow;"><code>ls /sys/class/hidraw</code></mark></td><td>List HID (Human Interface Device) Raw Devices.</td></tr><tr><td><mark style="color:yellow;"><code>ls /sys/class/input</code></mark></td><td>List Input Devices.</td></tr><tr><td><mark style="color:yellow;"><code>ls /sys/class/tty/ttyS*</code></mark></td><td>List Serial (TTY) Devices.</td></tr><tr><td><mark style="color:yellow;"><code>lshw -class storage</code></mark></td><td>List Storage Devices Using <mark style="color:yellow;"><code>lshw</code></mark> (requires installation).</td></tr><tr><td><mark style="color:yellow;"><code>smartctl -i /dev/&#x3C;device></code></mark></td><td>Display Information about SMART Capable Devices.</td></tr><tr><td><mark style="color:yellow;"><code>lsblk -f</code></mark></td><td>List Block Devices and Their Filesystem Types.</td></tr><tr><td><mark style="color:yellow;"><code>lsblk -o +SIZE</code></mark></td><td>List Block Devices and Their Sizes.</td></tr><tr><td><mark style="color:yellow;"><code>ls -l /dev/input</code></mark></td><td>List Input Devices Using Device Files.</td></tr><tr><td><mark style="color:yellow;"><code>ls -l /dev/serial/*</code></mark></td><td>List Serial Devices (alternative method).</td></tr><tr><td><mark style="color:yellow;"><code>cat /proc/asound/cards</code></mark></td><td>List Sound Cards.</td></tr><tr><td><mark style="color:yellow;"><code>cat /proc/tty/drivers</code></mark></td><td>List TTY (Terminal) Drivers and Devices.</td></tr><tr><td><mark style="color:yellow;"><code>cat /proc/bus/input/devices</code></mark></td><td>List Input Devices and Their Capabilities.</td></tr><tr><td><mark style="color:yellow;"><code>udevadm trigger</code></mark></td><td>Force Udev to Re-Enumerate Devices.</td></tr><tr><td><mark style="color:yellow;"><code>udevadm settle</code></mark></td><td>Wait for Udev to Settle After Device Changes.</td></tr><tr><td><mark style="color:yellow;"><code>udevadm info -q all -n /dev/&#x3C;device></code></mark></td><td>Retrieve Detailed Information for a Device.</td></tr><tr><td><mark style="color:yellow;"><code>cat /sys/class/hidraw/hidraw*/device/uevent</code></mark></td><td>List HIDRAW Devices.</td></tr><tr><td><mark style="color:yellow;"><code>find /sys/class/ -name 'sd*'</code></mark></td><td>List SCSI Disk Devices.</td></tr></tbody></table>

## <mark style="color:red;">Identify USBs/External Storage</mark>

<table data-header-hidden data-full-width="true"><thead><tr><th width="359">Command</th><th>Description</th></tr></thead><tbody><tr><td><mark style="color:yellow;"><code>mount</code></mark></td><td>List Mounted Filesystems and Devices.</td></tr><tr><td><mark style="color:yellow;"><code>dmesg | grep -i 'usb'</code></mark></td><td>Display USB device-related messages in the kernel ring buffer.</td></tr><tr><td><mark style="color:yellow;"><code>dmesg | grep -i 'sd'</code></mark></td><td>Display messages related to SCSI disks in the kernel ring buffer.</td></tr><tr><td><mark style="color:yellow;"><code>lsblk</code></mark></td><td>List block devices and their partitions.</td></tr><tr><td><mark style="color:yellow;"><code>lsusb</code></mark></td><td>List USB devices and hubs.</td></tr><tr><td><mark style="color:yellow;"><code>lsusb -t</code></mark></td><td>Display USB Device Tree.</td></tr><tr><td><mark style="color:yellow;"><code>ls -l /dev/disk/by-id/</code></mark></td><td>List disk devices by their unique IDs.</td></tr><tr><td><mark style="color:yellow;"><code>fdisk -l</code></mark></td><td>List partitions and drives.</td></tr><tr><td><mark style="color:yellow;"><code>blkid</code></mark></td><td>Display block device attributes, including UUIDs.</td></tr><tr><td><mark style="color:yellow;"><code>udevadm info -q all -n /dev/sdX</code></mark></td><td>Retrieve detailed information about a specific block device.</td></tr></tbody></table>

## <mark style="color:red;">File Locations</mark>

<table data-header-hidden data-full-width="true"><thead><tr><th width="159">Location</th><th>Description</th></tr></thead><tbody><tr><td>/dev/</td><td>Unix systems create device files in the /dev/ directory to represent connected devices.</td></tr><tr><td>/sys/</td><td>The /sys/ directory is a virtual filesystem that exposes information about connected devices and their attributes.</td></tr><tr><td>/proc/mounts</td><td>This file contains information about mounted filesystems, including external storage devices.</td></tr><tr><td>/proc/scsi/</td><td>Information about SCSI devices, including external storage devices, can be found in the /proc/scsi/ directory.</td></tr><tr><td>udev Rules</td><td>The udev subsystem manages devices and their associated information. Udev rules can be configured to perform actions when devices are connected or disconnected.</td></tr><tr><td>/var/log/</td><td>System log files, such as those located in /var/log/, may contain information about connected devices.</td></tr></tbody></table>
