Ubuntu, like many other Linux distributions, provides various commands to list and manage USB devices connected to your system. This can be useful for tasks such as identifying connected USB drives, checking their file system, or obtaining detailed information about the USB devices.
In this article, we will explore several commands commonly used to list USB devices in Ubuntu.
- Using df Command
- Using lsblk Command
- Using fdisk Command
- Using lsusb Command
- Using usb-devices Command
Method 1: Using df Command
The `df` command stands for “disk free” and is typically used to display information about the file system usage. The `-Th` options ensure that the output includes file system types (like ext4, ntfs, etc.) and uses human-readable sizes. The `grep media` part filters the output to show only the devices mounted under `/media`.
df -Th | grep media
This command will display information about file systems mounted under `/media`, which often includes USB drives.
Method 2: Using lsblk Command
The `lsblk` command lists block devices, providing information about disks and their partitions. By piping the output to `grep media`, we can filter and display only devices mounted under `/media`.
lsblk | grep media
This command helps identify block devices (including USB drives) mounted under `/media`.
Method 3: Using fdisk Command
The `fdisk` command is a disk partitioning utility that can list, create, and manage disk partitions. Using the `-l` option, `fdisk` displays information about all available partitions. By piping the output to `grep sdb1`, we can filter and display information about a specific partition, often associated with a USB drive.
sudo fdisk -l | grep sdb1
This command helps to specifically list information about the partition ‘sdb1’, which is commonly associated with a USB drive.
Method 4: Using lsusb Command
The `lsusb` command lists USB devices connected to the system. It provides information about the vendor and product IDs, allowing you to identify the connected USB devices.
This command will display a list of all connected USB devices, along with their respective details.
Method 5: Using usb-devices Command
The `usb-devices` command provides detailed information about USB devices and their properties, including vendor and product IDs, bus numbers, and more.
This command offers a comprehensive view of connected USB devices and their attributes.
In summary, using these commands in Ubuntu allows you to list and gather detailed information about the USB devices connected to your system. Whether you need to identify the devices or retrieve specific details about them, these commands are valuable tools for managing USB devices in a Linux environment.