I am connecting to a server via SSH, and I'd like to know how fast it's uploading and downloading. Preferably I'd also like to see what is downloading/uploading and the speed for that process. Any suggestions, or hints on what I should be searching for?
5 Answers
To get a more specific breakdown of traffic, I use tcpdump and pass the dump to wireshark. Then use the statistics menu. But for ssh, it will be hard to see what is going on since it is already encrypted. Do you just want to the speed of your transfers? rsync --progress -av srouce/ dest/
will do that.
Or maybe you want: IP/Process based bandwidth usage stats tool for linux?
If you don't want to install anything, you can cat /proc/net/dev
over an interval (Maybe in a loop with sleep), and then just take the difference of the send and receive bytes between the two polling.
For a program, I liked apt-get install bmon
. bmon is a nice little terminal curses program.

- 83,619
- 74
- 305
- 448
-
Oops, read to quickly, didn't see you wanted per process :-/ – Kyle Brandt Dec 02 '09 at 19:32
-
Woah, bmon is neat! To be honest, per process was just a nice-to-have. – Nick Bolton Dec 02 '09 at 19:54
Or if you don't have root access, the data is stored in /proc/net/dev. Little hacked up python script I wrote a bunch of years ago to do it w/o pcap/root.

- 11
- 1
Just to summarize from Kyle Brandt and Flow's answers. I just compared bmon
and iftop
(both installable using apt-get on Debian). Both are ncurses applications, and are really quite neat!
bmon
gives only a general usage, but has a pretty graph :)iftop
shows detailed usage between each connection (and shows source/dest ips)
Thanks for your answers!

- 5,126
- 12
- 54
- 62
I didn't like any of these answers. Either it required some 3rd party program or was too much info.
Really you can find all the net info you need in the following path. Replace $int_name with your interface name
/sys/class/net/$int_name/statistics
Examples:
- rx bytes per second =
$(cat /sys/class/net/$int_name/statistics/rx_bytes)
- tx bits per second =
$(expr $(cat /sys/class/net/$int_name/statistics/tx_bytes) \*8)
- tx pps =
$(cat /sys/class/net/$1/statistics/tx_packets)
You can use this script I created below to show all tx, rx, and totals for a given interface. I call it ninfo
#!/bin/bash
output(){
echo "==== $1 ===="
echo "rx_bits $(expr $(cat /sys/class/net/$1/statistics/rx_bytes) \* 8)"
echo "rx_bytes $(cat /sys/class/net/$1/statistics/rx_bytes)"
echo "tx_bits $(expr $(cat /sys/class/net/$1/statistics/tx_bytes) \* 8)"
echo "tx_bytes $(cat /sys/class/net/$1/statistics/tx_bytes)"
echo "rx_packets $(cat /sys/class/net/$1/statistics/rx_packets)"
echo "tx_packets $(cat /sys/class/net/$1/statistics/tx_packets)"
echo "total_bits $(expr $(expr $(cat /sys/class/net/$1/statistics/tx_bytes) \* 8) + $(expr $(cat /sys/class/net/$1/statistics/rx_bytes) \* 8))"
echo "total_bytes $(expr $(cat /sys/class/net/$1/statistics/tx_bytes) + $(cat /sys/class/net/$1/statistics/rx_bytes))"
echo "total_packets $(expr $(cat /sys/class/net/$1/statistics/tx_packets) + $(cat /sys/class/net/$1/statistics/rx_packets))"
}
if [ -z $1 ]; then
echo "[!] ERROR: please provide an interfaces name"
exit 1
fi
cints=$(ip -br a | awk '{print$1}' | sed 's/@.*//g')
found=0
for i in $cints; do
if [ "$i" == "$1" ]; then
found=1
else
:
fi
done
if [ $found -eq 1 ]; then
output $1
else
echo "[!] ERROR: '$1' is not an interface on this system. Must use one of the following:"
echo "$cints"
exit 1
fi
To use run ninfo $int_name
.
Tthe script will list interfaces on your system if you dont know the names.
Now I said that I dont like 3rd part programs for this but check out mmwatch
its a utility that works like watch
but converts diff integers for rates:
https://github.com/cloudflare/cloudflare-blog/blob/master/2017-06-29-ssdp/mmwatch
Download it and save in your path. Then you can run mmwatch + my script
mmwatch "./ninfo $int_name"
Now you can view rates.

- 229
- 2
- 10