Viewing network bandwidth usage using the Bandwhich tool

Bandwhich,Previously whatIs a command line, open source utility that displays network bandwidth usage by process, connection, remote IP or hostname. Sniff the specified network interface card, record the IP packet size, and finally cross-reference. / proc File system on Linux system or lsof Mac OS commands. Written in rust A programming language that supports Linux and Mac OS.

Install Bandwhich

Bands available in AUR, Can be installed using the AUR helper. For example Hooray, Commands using Arch Linux and its variants:

$ yay -S bandwhich

using Knicks Package Manager:

$ nix-env -iA nixpkgs.bandwhich

On other Linux distributions, you can install using: cargo Package manager.

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

  • Install Rust programming language on Linux

After installing Rust, use commands to install Bandwhich.

$ cargo install bandwhich

The above command will install bandwhich ~ / .Cargo / bin / bandwhich. Therefore, you need to enter the full path each time to execute bandwhich as follows:

$ sudo ~/.cargo/bin/bandwhich

To fix this, move the bandwhich binary to $ PATH (for example, / usr / local / bin /) by creating a symbolic link similar to the following:

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

You can now easily run bandwhich using commands.

$ sudo bandwhich

Bandwhich sniffs network packets, root Privileges. So you need to do it Sudo Prefix.

trouble shooting

When installing Bandwhich using Cargo, the following error may occur:

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 solutions.

  • How to fix Rust error “ linker ‘cc’ not found ” on Linux

Viewing network bandwidth usage using the Bandwhich tool

To view the current bandwidth usage by process, connection, IP, or host name:

$ sudo bandwhich

Sample output from Ubuntu 18.04 LTS desktop:

To stop Ctrl + c.

By default, Bandwhich shows network usage from all network interfaces. For example, if you want Bandwhich to listen on a specific network card wlp9s0, use -I National flag.

$ sudo bandwhich -i wlp9s0

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     The network interface to listen on, eg. eth0

Hope it helps.

resource:

.

Sidebar