- Identify newly connected or disconnected USB devices
- Works with any USB device (keyboards, mice, storage, etc.)
- Simple interactive interface
- No installation required (just Python 3 and lsusb)
- Linux (uses
lsusbcommand) - Python 3.6+
- Root access (recommended for complete device visibility)
- Clone this repository or download the
which-usbscript - Make it executable:
chmod +x which-usb
- (Optional) Move it to your PATH for easy access:
sudo mv which-usb /usr/local/bin/
Run the script:
./which-usbOr with root privileges (recommended for best results):
sudo ./which-usb-
Choose your workflow:
- Option 1: Start with the device disconnected, then connect it when prompted
- Option 2: Start with the device connected, then disconnect it when prompted
-
Follow the on-screen instructions to capture the USB device states
-
The tool will compare the before and after states and display the differences
=== Which USB Device? ===
This tool helps identify USB devices by comparing connection states.
Choose a workflow:
1. Start with device disconnected (I'll connect it when prompted)
2. Start with device connected (I'll disconnect it when prompted)
3. Exit
Enter your choice (1-3): 1
Please make sure the device is disconnected.
Press Enter when ready to capture the first state...
Captured 12 devices.
Now please connect the device and press Enter when done...
Captured 13 devices.
Newly connected device(s):
1. Logitech, Inc. Unifying Receiver (Vendor: 046d, Product: c52b)





