Home Command line utilities How To Find USB Device Bandwidth Usage On Linux
How To Find USB Device Bandwidth Usage On Linux

How To Find USB Device Bandwidth Usage On Linux

By sk
132 Views

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.

Installing Usbtop

Usbtop is available in AUR, so you can install it on Arch linux and its variants using any AUR helper, for example Yay.

$ 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 ..
$ make
$ 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

Sample output:

Find USB Device Bandwidth Usage On Linux Using usbtop

Find USB Device Bandwidth Usage On Linux Using Usbtop Utility

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.


Suggested read:


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.

Resource:

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You May Also Like

2 comments

Iliyan August 23, 2019 - 12:37 pm

Double Commander gives this info by copiing and writing files to flash drive – it is quite easier.

Reply
sk August 23, 2019 - 12:47 pm

I didn’t know. Thanks.

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More