A terminal-based TCP connection monitoring tool that provides real-time visualization of network connections on your system.
tcpcount is a command-line tool that monitors TCP connections on your system and displays them in an easy-to-read dashboard. It shows:
- Active connections in real-time
- Connection statistics grouped by remote host, process, and process-host combinations
- Historical data with graphs showing connection trends over time
- Filtering capabilities to focus on specific processes, hosts, or ports
Concurrency Analysis: tcpcount is particularly useful for understanding connection concurrency patterns. It tracks not just current active connections, but also the maximum number of concurrent connections reached over time. This helps you understand:
- How many connections your applications are making simultaneously
- Peak connection usage and potential bottlenecks
- Whether connection pooling is working effectively
- Connection patterns that might indicate performance issues
- Resource utilization for capacity planning
This is useful for system administrators, network engineers, and anyone who needs to monitor network activity on their system.
You'll need Rust and Cargo installed on your system. If you don't have them:
On macOS/Linux:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source ~/.cargo/env- Clone or download the source code to your system
- Navigate to the project directory in your terminal
- Build and install with cargo:
cargo build --release
cargo install --path .This will compile the application and install it to your cargo bin directory (usually ~/.cargo/bin/ on macOS/Linux).
If you prefer not to install globally, you can run it directly:
cargo run --releaseRun tcpcount without any arguments to monitor all TCP connections:
tcpcounttcpcount supports several filtering options:
# Filter by process ID
tcpcount -p 1234
# Filter by process name (case-sensitive)
tcpcount -n "firefox"
# Filter by remote host
tcpcount -H "google.com"
# Filter by remote port
tcpcount -P 443
# Combine multiple filters
tcpcount -n "chrome" -P 80Available Options:
-p, --pid <PID>- Filter by process ID-n, --process-name <NAME>- Filter by process name (substring match)-H, --host <HOST>- Filter by remote host (substring match)-P, --port <PORT>- Filter by remote port
The tcpcount interface is divided into several sections:
┌─────────────────────────────────────────────────────────────────────────────┐
│ [Connection Graph] [Summary Stats] │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ [Process-Host Table] │
│ │
├─────────────────────────────────────────────────────────────────────────────┤
│ [Host Table] │ [Process Table] │
├─────────────────────────────────────────────────────────────────────────────┤
│ [Status Bar] │
└─────────────────────────────────────────────────────────────────────────────┘
- Connection Graph - Shows active connections over time
- Summary Stats - Displays current totals and statistics
- Process-Host Table - Shows connections grouped by process and remote host
- Host Table - Shows connections grouped by remote host
- Process Table - Shows connections grouped by process name
- Status Bar - Shows current filters and available keyboard shortcuts
Host Table:
- Remote Host: The hostname or IP address
- Port: The remote port number
- Active: Currently active connections
- Total: Total connections seen
- Max: Maximum concurrent connections
Process Table:
- Process: Process name
- PID: Process ID
- Active: Currently active connections
- Total: Total connections seen
- Max: Maximum concurrent connections
Process-Host Table:
- Process: Process name
- Remote Host: The hostname or IP address
- Port: The remote port number
- Active: Currently active connections
- Total: Total connections seen
- Max: Maximum concurrent connections
- ↑/↓ Arrow Keys - Scroll up/down in the focused table
- Page Up/Page Down - Scroll by larger increments
- Home/End - Jump to top/bottom of the focused table
- 1/2/3 - Switch focus between tables:
- 1 - Focus Process-Host table
- 2 - Focus Host table
- 3 - Focus Process table
- f - Open filter dialog to set custom filters
- c - Clear all active filters
- t - Sort by Total connections
- a - Sort by Active connections
- m - Sort by Max concurrent connections
- r - Reset/refresh connection data
- q - Quit the application
- Scroll Wheel - Scroll the focused table up/down
# Monitor Chrome browser connections
tcpcount -n "chrome"
# Monitor SSH connections
tcpcount -P 22# Monitor connections to Google services
tcpcount -H "google"
# Monitor HTTPS connections
tcpcount -P 443# Monitor process with PID 1234
tcpcount -p 1234- Use filters to focus on specific network activity you're interested in
- Switch between tables (1/2/3 keys) to view data from different perspectives
- Use sorting (t/a/m keys) to prioritize different aspects of connection data
- Check the status bar for current filters and available shortcuts
- Use the graph to spot patterns in connection activity over time
- Operating System: Linux or macOS
- Rust: 1.70 or later
- Privileges: May require elevated privileges (sudo/admin) to access all network information on some systems
Permission Issues: If you get permission errors, try running with elevated privileges:
sudo tcpcount # Linux/macOSBuild Errors: Make sure you have the latest stable Rust version:
rustup update stableNo Data Showing:
- Check if there are active TCP connections on your system
- Try running without filters first
- Ensure you have the necessary permissions to read network information
