| Crates.io | which-usb |
| lib.rs | which-usb |
| version | 0.1.0 |
| created_at | 2025-08-13 13:50:16.004325+00 |
| updated_at | 2025-08-13 13:50:16.004325+00 |
| description | A command-line tool to list all currently connected USB devices |
| homepage | |
| repository | https://github.com/Uriel-090/which-usb |
| max_upload_size | |
| id | 1793642 |
| size | 28,145 |
A fast and lightweight command-line tool to list all currently connected USB devices on your system.
Make sure you have Rust installed, then:
git clone https://github.com/Uriel-090/which-usb.git
cd which-usb
cargo build --release
The binary will be available at target/release/which-usb.
cargo install which-usb
# List all USB devices in a simple table format
which-usb
# Show verbose information including manufacturer, product names, etc.
which-usb --verbose
# Short form
which-usb -v
# Table format (default)
which-usb --format table
# JSON format
which-usb --format json
# CSV format
which-usb --format csv
# Filter by vendor ID (hexadecimal)
which-usb --vendor 046d
# Filter by product ID (hexadecimal)
which-usb --product c52b
# Combine filters
which-usb --vendor 046d --product c52b --verbose
$ which-usb
Bus Addr VID PID Speed
----------------------------------------
001 001 1d6b 0002 High (480 Mbps)
001 002 8087 0024 High (480 Mbps)
001 003 046d c52b Full (12 Mbps)
002 001 1d6b 0003 Super (5 Gbps)
Total devices found: 4
$ which-usb --verbose
Bus Addr VID PID Manufacturer Product Serial Speed
--------------------------------------------------------------------------------------------------------------
001 001 1d6b 0002 Linux Foundation 2.0 root hub N/A High (480 Mbps)
001 002 8087 0024 Intel Corp. Integrated Rate Matching Hub N/A High (480 Mbps)
001 003 046d c52b Logitech, Inc. Unifying Receiver N/A Full (12 Mbps)
002 001 1d6b 0003 Linux Foundation 3.0 root hub N/A Super (5 Gbps)
Total devices found: 4
$ which-usb --format json
[
{
"bus": 1,
"address": 1,
"vendor_id": 7531,
"product_id": 2,
"device_version": 1030,
"manufacturer": "Linux Foundation",
"product": "2.0 root hub",
"serial_number": null,
"class": 9,
"subclass": 0,
"protocol": 1,
"max_packet_size": 64,
"num_configurations": 1,
"speed": "High (480 Mbps)"
}
]
which-usb [OPTIONS]
Options:
-f, --format <FORMAT> Output format [default: table] [possible values: table, json, csv]
-v, --verbose Show verbose device information
--vendor <VENDOR> Filter by vendor ID (hexadecimal, e.g., 1234)
--product <PRODUCT> Filter by product ID (hexadecimal, e.g., 5678)
-h, --help Print help
-V, --version Print version
Linux: libusb-1.0 development package
# Ubuntu/Debian
sudo apt install libusb-1.0-0-dev
# Fedora/RHEL
sudo dnf install libusb1-devel
# Arch Linux
sudo pacman -S libusb
macOS: No additional dependencies (libusb is included with Xcode Command Line Tools)
Windows: No additional dependencies required
On Linux and macOS, you might need appropriate permissions to access USB device information:
# Add your user to the appropriate group (Linux)
sudo usermod -a -G plugdev $USER
# Or run with sudo for full access
sudo which-usb --verbose
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)This project is licensed under either of
at your option.
sudo or ensure your user has appropriate USB access permissionsplugdev grouplsusb - Standard Linux utility for listing USB devicessystem_profiler SPUSBDataType - macOS system profilerwhich-usb aims to provide a consistent, cross-platform experience with modern output formatting options.