Home Command line utilities Display Network Bandwidth Utilization Using Bandwhich Tool
Display Network Bandwidth Utilization Using Bandwhich Tool On Linux

Display Network Bandwidth Utilization Using Bandwhich Tool

By sk
87 Views

Bandwhich, previously known as What, is a command line, open source utility to display network bandwidth utilization by process, connection and remote IP or hostname. It sniffs the given network interface card and records IP packet size and finally cross reference it with the /proc filesystem on your Linux system or lsof command on Mac OS. It is written in Rust programming language and supports Linux and Mac OS.

Install Bandwhich

Bandwhich is available in AUR, so you can install it using any AUR helpers, for example Yay, on Arch Linux and its variants using command:

$ yay -S bandwhich

Using Nix package manager:

$ nix-env -iA nixpkgs.bandwhich

On other Linux distributions, you can install it using Cargo package manager.

To use Cargo package manager, you need to install Rust programming language as described in the link given below.

After installing Rust, install Bandwhich using command:

$ cargo install bandwhich

The above command will install bandwhich to ~/.cargo/bin/bandwhich. So you need to type the full path each time to run bandwhich as shown below.

$ sudo ~/.cargo/bin/bandwhich

To fix this, just move the bandwhich binary to your $PATH (E.g. /usr/local/bin/) by creating symbolic link like below.

$ sudo ln -s ~/.cargo/bin/bandwhich /usr/local/bin/

Now, you can simply run bandwhich using command:

$ sudo bandwhich

Please be mindful that since bandwhich sniffs network packets, it requires root privileges. So you must run it with sudo prefix.

Troubleshooting

You might be encountered with the following error when installing Bandwhich using Cargo.

Updating crates.io index
Installing bandwhich v0.6.0
Compiling libc v0.2.66
error: linker `cc` not found
|
= note: No such file or directory (os error 2)
[...]

To fix this error, try the following solution.

Display Network Bandwidth Utilization Using Bandwhich Tool

To display the current bandwidth utilization by process, connection, IP or hostname, run:

$ sudo bandwhich

Sample output from my Ubuntu 18.04 LTS desktop:

Display Network Bandwidth Utilization Using Bandwhich Tool

To stop, press Ctrl+c.

By default, Bandwhich will display the network utilization from all network interfaces. If you want Bandwhich to listen on a particular network card, for example wlp9s0, use -i flag.

$ sudo bandwhich -i wlp9s0

For help:

$ bandwhich --help
bandwhich 0.6.0

USAGE:
    bandwhich [FLAGS] [OPTIONS]

FLAGS:
    -h, --help          Prints help information
    -n, --no-resolve    Do not attempt to resolve IPs to their hostnames
    -r, --raw           Machine friendlier output
    -V, --version       Prints version information

OPTIONS:
    -i, --interface <interface>    The network interface to listen on, eg. eth0

Hope this helps.

Resource:

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You May Also Like

2 comments

noldor January 6, 2020 - 2:54 pm

What terminal emulator at screenshot?

Reply
sk January 6, 2020 - 3:12 pm

Deepin Terminal on Ubuntu 18.04 LTS.

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