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

The darkstat utility is an efficient network traffic analyzer that captures network traffic, calculates usage statistics, and serves reports over an embedded lightweight HTTP web server. On minimal Linux server distributions, container base images, and cloud server instances, darkstat is omitted by default, returning the bash: darkstat: command not found error when executing network inspections.

Install darkstat on Ubuntu, Debian, and Derivatives

On Debian-based systems, darkstat is maintained directly in the universe software repositories:

  1. Update your local package lists:
    sudo apt update
  2. Install the darkstat package:
    sudo apt install -y darkstat
  3. Confirm successful installation and view the binary path:
    which darkstat
    darkstat --version

Install darkstat on RHEL, AlmaLinux, Rocky Linux, and Arch Linux

On enterprise Linux distributions and rolling releases, darkstat can be installed via EPEL or the Arch User Repository:

  1. On RHEL or Rocky Linux, enable EPEL and install via DNF:
    sudo dnf install -y epel-release && sudo dnf install -y darkstat
  2. On Arch Linux, install from the official extra repositories:
    sudo pacman -Syu darkstat

Launch darkstat and Access Embedded Web Reports

Start the traffic monitor bound to a specific network interface and port:

  • Launch darkstat listening on interface eth0 and serving reports on port 667:
    sudo darkstat -i eth0 -p 667 --no-promisc
  • Open your web browser and navigate to http://server-ip:667 to review real-time host traffic tables, protocols, and bandwidth graphs.
  • To run darkstat permanently as a background service on Debian/Ubuntu, edit /etc/darkstat/init.cfg, set START_DARKSTAT=yes, and run sudo systemctl restart darkstat.

Get the best tech tips delivered straight to your inbox.

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