The other day I wanted to check how much bandwidth is being used by my external USB drive when transferring files from local hdd drive to external drive. While looking for an easy way, I came across a command line utility named "Usbtop". Usbtop is a top-like CLI utility that helps us to find USB device bandwidth usage on Linux. It shows an estimated instantaneous bandwidth on USB buses and devices. Using this tool, we can easily check what devices are using how much bandwidth.
$ yay -S usbtop
On Debian, it is available in the default repositories. Run the following command to install it:
$ sudo apt install usbtop
On Ubuntu and its derivatives, you need to compile and install it from source like below.
Install required dependencies:
$ sudo apt update
$ sudo apt install cmake git libboost-dev libpcap-dev libboost-thread-dev libboost-system-dev
Git clone Usbtop repository on your local system:
$ git clone https://github.com/aguinet/usbtop.git
The above command will clone all the contents of Usbtop repository in "usbtop" directory in the current working directory. Cd into the usbtop directory:
$ cd usbtop
Next create local build directory and cd into it:
$ mkdir _build && cd _build
Finally, install Usbtop by running the following commands one by one:
$ cmake -DCMAKE_BUILD_TYPE=Release ..
$ sudo make install
Once installed, make sure the usbmon module is loaded.
$ sudo modprobe usbmon
Find USB Device Bandwidth Usage On Linux Using Usbtop
Connect your USB drive and copy some files in it. Open Terminal and run usbtop command with sudo privileges to estimate bandwidth usage.
$ sudo usbtop
As you can see in the above output, Usbtop displays bandwidth usage on USB buses and devices. On the top, you will see the overall bandwidth usage on all USB buses and below it you will see bandwidth on each bus.
To list all available USB buses, run:
$ usbtop --list Name Description --------------------------- usbmon1 USB bus number 1 usbmon2 USB bus number 2 usbmon3 USB bus number 3 usbmon4 USB bus number 4
To monitor bandwidth traffic on a specific USB bus, run:
$ sudo usbtop --bus usbmon1
This command will monitor bandwidth traffic on usbmon1 bus only.
For details, refer the help section.
$ usbtop --help
I have tested with USB external drive and thumb drive. You can, however, use it for all devices such as USB webcam, printer etc., to monitor bandwidth.
- How To Monitor WiFi Connection From Command Line In Linux
- The Top Command Tutorial With Examples For Beginners
- Some Alternatives To ‘top’ Command line Utility You Might Want To Know
I will keep looking for more utilities to check bandwidth usage of USB buses and devices and update this guide accordingly. Bookmark and visit it later.