Display the bandwidth occupied by the network bandwidth on Linux and macOS

band It is a relatively new terminal bandwidth utilization tool written in Rust for Linux, *BSD and macOS. It displays the current network utilization by process, connection and remote IP/host name.

The main purpose of this tool is to display the content that takes up your bandwidth. It was originally called “what”, but its name was changed to band about three weeks ago.
Frequency band, it can display the current network utilization by process, connection and remote IP/host name by sniffing the given network interface and recording the IP packet size, and cross-reference with it /proc Linux and lsof On macOS. In addition, the tool attempts to use reverse DNS “best effort” to resolve IP addresses to their hostnames in the background. can use -n / --no-resolve Options.
By default, band runs interactively. It has 3 panes, which display respectively: network utilization by process name, connection utilization, and remote address utilization. Because the band has a responsive terminal user interface, the terminal window running the band must be large enough to display these three panes-depending on the width and/or height of the window, only one or two of them may be displayed.

Bandwidth network bandwidth usage tool
Band with responsive terminal user interface

If you only want to show one of these panes, the band has an option-use -a / --addresses Only show the address table, -c / connections Show only the network connection table, or use -p / --processes Only the progress meter is displayed.
This feature allows you to select the panes/tables to be displayed on the command line. This feature was only recently added and supports IPv6 and VPN traffic on Mac. Recently, support for the WireGuard interface has been added, as well as a small but useful feature that allows SPACE Key (only for interactive mode-not for original mode).

Original mode
Run the band in raw mode, filter the result of “rclone” (bandwhich --raw | grep rclone)

In addition to the interactive mode, the band also has an original mode (to use this mode, you can -r / --raw Option) to produce machine-friendly output. This mode automatically scrolls the original output without deleting any previous lines. It would be useful if this would display a regular timestamp in the form of %H:%M:%S, but this feature may be added in future releases. Related information: Use termhark to analyze network traffic, which is the terminal user interface of TShark (Wireshark)
It is also worth noting that, by default, band displays the bandwidth utilization of all available (active) network interfaces. If you want to specify a specific network interface to listen on, use -i / --interface Option, followed by the name of the network interface, such as eth0, enp4s0, or anything called an interface.
There are many tools that can display network bandwidth utilization on the command line, including iftop, nethogs and other tools. Bands are similar in some ways, but they are also different in doing things.
For example, iftop displays the bandwidth usage of the interface on the interface by host, but does not show the process of using bandwidth. On the other hand, nethogs is a command line tool that groups the bandwidth of each process (it displays PID, user, program, interface, and the sent/received information of each PID). Compared with bandband, it displays The information is much similar, but nethogs lacks the original output mode, which is very useful in various situations. In addition, nethogs will not display a single connection. The way of presenting information is also different. Personally, I really like the frequency band of the end user interface.
In any case, I am not preaching here, but just to inform. Use your favorite tool that best suits your needs.

Install band

Which project page of the band linked above has installation instructions for Arch Linux, Nix/NixOS, Void Linux, Fedora (Copr) and macOS. There are also instructions for installing band using the Rust package manager Cargo, which can be used on any Linux distribution. The application cannot run on Microsoft Windows at least for now.
The easiest way to install band on a Linux distribution where no software package is available is to download pre-compiled binaries from Linux. The band that released the tag, And then decompress the archive file to prepare the band executable file. You may need to install it somewhere of yours $PATH, E.g /usr/local/bin -You can install it there using (run this command in the folder where you extracted the band binary):

sudo install bandwhich /usr/local/bin

It is important to note that because band sniffs network packets, it requires root privileges. Run it sudo On MacOS and Linux, or only on Linux, you can use the following command to give the band the required privileges for the binary file so that it does not need to be run with sudo:

sudo setcap cap_sys_ptrace,cap_dac_read_search,cap_net_raw,cap_net_admin+ep `which bandwhich`