I had the need to view the live outgoing bandwidth and connection stats on a web server recently to investigate a performance bottleneck, and I found tcptrack which allows you to do just that.
To install tcptrack, execute the following command:
sudo apt-get install tcptrack
You can then view live bandwidth and connections by executing the following command:
root@server:~# tcptrack -i eth0
Client Server State Idle A Speed
85.x.x.x:61840 149.x.x.x:22 ESTABLISHED 0s 10 KB/s
149.x.x.x:43574 95.x.x.x:80 SYN_SENT 0s 0 B/s
149.x.x.x:53540 95.x.x.x:443 SYN_SENT 0s 0 B/s
172.x.x.x:12142 149.x.x.x:80 CLOSED 1s 0 B/s
149.x.x.x:35366 104.x.x.x:443 ESTABLISHED 2s 0 B/s
172.x.x.x:63306 149.x.x.x:80 ESTABLISHED 2s 0 B/s
172.x.x.x:64676 149.x.x.x:80 ESTABLISHED 4s 0 B/s
172.x.x.x:28720 149.x.x.x:80 ESTABLISHED 9s 0 B/s
172.x.x.x:34900 149.x.x.x:80 ESTABLISHED 12s 0 B/s
172.x.x.x:29632 149.x.x.x:80 ESTABLISHED 13s 0 B/s
172.x.x.x:22742 149.x.x.x:80 ESTABLISHED 13s 0 B/s
Replace eth0
with your interface name if required (run ifconfig
to list all interfaces).
It also provides you with additional sort options: Sorted by rate
or Sorted by bytes
.