Efficient network usage monitoring is a crucial task for system administrators and developers. Bandwhich positions itself as an essential tool for this purpose, offering real-time data on bandwidth consumption by process, connection, and IP directly in the terminal.
What is Bandwhich?
Bandwhich is a terminal-based user interface (TUI) tool designed to analyze network usage in detail and in real-time. Compatible with Linux, macOS, and Windows, this utility is ideal for quickly identifying which processes or connections are consuming the most resources, facilitating troubleshooting and system optimization.
Its key features include:
- Real-time visualization of network traffic by processes and connections.
- Reverse DNS resolution to map IP addresses to hostnames.
- Support for capturing network data and saving it to log files for later analysis.
- Cross-platform compatibility and user-friendly operation for all technical levels.
How Does Bandwhich Work?
Bandwhich uses tailored network traffic analysis techniques for each operating system. On Linux, it leverages the /proc
filesystem to map open ports to their respective processes. On macOS, it relies on the lsof
command, while on Windows, it uses native system APIs.
Its terminal interface dynamically adapts to window size, ensuring the most relevant information is always visible, even on smaller screens.
Key Features
- Monitoring by Processes and Connections
Bandwhich groups and displays network traffic by process, remote address, or specific connections, enabling granular analysis. - Customizable Output
Offers viewing options such as showing only process tables, connection details, or remote addresses, with the ability to export captured data in machine-readable formats. - Cross-Platform Compatibility
Works on Linux systems (ARM and x86), macOS (both Apple Silicon and Intel-based), and Windows, ensuring accessibility for a wide range of users. - DNS Resolution and Custom Servers
Automatically resolves IP addresses to hostnames and allows users to configure a specific DNS server for precise results. - Advanced Usage Modes
Includes options to display cumulative bandwidth usage, change measurement units (bytes or bits, binary or SI), and record detailed logs for debugging.
Installation
Installing Bandwhich is straightforward, with specific methods for each operating system:
- Linux:
cargo install bandwhich
Elevated privileges are required to capture network packets. You can achieve this by usingsudo
or assigning capabilities to the binary withsetcap
. - macOS:
Install via Homebrew:brew install bandwhich
- Windows:
First, install Npcap for packet capture. Then, use an appropriate package manager to install Bandwhich. - From Source Code:
git clone https://github.com/imsnif/bandwhich.git
cd bandwhich
cargo build --release
Use Cases
- Network Troubleshooting
Bandwhich helps identify processes or connections consuming excessive network resources, making it easier to detect bottlenecks or unusual activity. - Bandwidth Optimization
By understanding which applications are using the most bandwidth, administrators can prioritize or limit certain processes based on system needs. - Server Monitoring
For production environments, Bandwhich ensures optimal performance by providing accurate real-time network traffic information.
Basic Usage
When running Bandwhich, you can specify the network interface to monitor:
bandwhich -i eth0
Other examples include:
- Displaying only active connections:
bandwhich --connections
- Logging network data for later review:
bandwhich --log-to logfile.log
- Disabling DNS resolution for faster results:
bandwhich --no-resolve
The Future of Bandwhich
Although the project is in passive maintenance, it remains a valuable tool for system administrators and developers. The community is encouraged to contribute improvements or new features via pull requests in the official GitHub repository.
Conclusion
Bandwhich is an indispensable tool for professionals who need precise and efficient network traffic monitoring. Its intuitive interface and broad compatibility make it a powerful solution for addressing challenges in local networks and production environments.
For more information, visit the official Bandwhich GitHub repository.