How to Fix bash: bandwhich: command not found in Minimal Linux Distributions

Executing bandwhich in a Linux shell to monitor real-time network bandwidth utilization by process often results in the error bash: bandwhich: command not found. Because bandwhich is written in Rust and not part of the standard GNU Coreutils collection, minimal server images require package repository setup or Cargo compilation.

Install bandwhich via Native Package Managers

Install the utility using the standard package repositories available on your distribution:

  • Ubuntu / Debian: sudo apt update && sudo apt install -y bandwhich
  • Arch Linux: sudo pacman -S bandwhich
  • Fedora: sudo dnf install bandwhich
  • Alpine Linux: sudo apk add bandwhich

Install via Rust Cargo Binary Manager

If your distribution’s default package mirrors do not carry the binary, compile and install directly via Cargo:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
cargo install bandwhich

Grant Raw Socket Capabilities

Because bandwhich sniffs raw network packets to map traffic back to specific socket PIDs, set packet capture permissions or run with administrative privileges:

sudo setcap cap_net_raw,cap_net_admin+ep $(which bandwhich)
bandwhich

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.