2

This question already has an answer here:

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

marked as duplicate by Mark Kirby, Videonauth, Eric Carvalho, muru command-line Jun 3 '16 at 9:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Are you just looking for the local machine statistics, or your whole network? – Christopher Angulo-Bertram May 29 '16 at 7:44
2

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

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.