3

Uplink and Downlink speeds, other statistics etc without third party software

3 Answers3

3

I use iftop.

Install it (290 KB) with sudo apt-get install iftop and start with sudo iftop.

Should you wish to monitor wireless internet traffic, use sudo iftop -i wlp3s0,

where -i referes to interface, and wlp3s0 is my wireless interface (check yours by running lspci.

enter image description here

Mookey
  • 4,801
0

There are not too many tools that come built in, but here is a great page that as you read through the thread, you will find the ones that are already installed.

How to display network traffic in terminal

All of these only show the local traffic of the machine this is installed on, if you wanted to monitor your whole network, you would need to use the machine as a proxy server, or even a firewall and have all machines go through this machine. Most firewalls have traffic monitors built in so you can see where the traffic is coming from and going to.

0

You can write a script around /proc/net/dev, for instance:

#!/bin/bash

dev=$1
[[ -z $1 ]] && dev=$(grep -o "eth." /proc/net/dev | head -1)


function getcount
{
        echo $(grep $dev /proc/net/dev | tr ':' ' ' | tr -s ' ' | cut -d ' ' -f 3,11)
}


current=($(getcount))
[[ -z $current ]] && echo "No network device \"$dev\"" && exit 1

printf "%10s %4s %4s \n" Device Recv Send

for i in $(seq 1000)
do
        sleep 1
        new=($(getcount))
        recvdiff=$(( ${new[0]} - ${current[0]} ))
        senddiff=$(( ${new[1]} - ${current[1]} ))
        recvdiff=$(( $recvdiff / 1024 ))
        senddiff=$(( $senddiff / 1024 ))
        printf "%10s %4d %4d\r" $dev $recvdiff $senddiff
        current=(${new[*]})
done
xenoid
  • 5,504