1

Is it possible to retrieve the current download speeds on my desktop? For example, if I were to download a file, the network card will report the speed that it's downloading the file at - I've seen it's possible in various applications for Windows.

I've tried using nload but that's a continuous program. I'm looking for a simple command that will output an integer and that's it.

Zanna
  • 70,465

1 Answers1

0

If you are using Ubuntu, this command will print out the information to help you to compute the speed.

cat /proc/net/dev

A sample output of the above command line is something like this:

$ cat /proc/net/dev
Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
    lo: 1094736293 1076693    0    0    0     0          0         0 1094736293 1076693    0    0    0     0       0          0
  eno1: 132120552758 616841563    0    0    0     0          0   1323233 376143801828 548682127    0    0    0     0       0          0
wlp2s0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0

From there, you can use grep, or awk, or cut, or regular expression to filter only the interface that you want to see (i.e. the wireless interface).

For example, if your wireless interface is eno1, using this command line will print out the current receive/transmit Kbytes per second:

awk '{i++; recv[i]=$1; trans[i]=$2}; END{print (recv[2]-recv[1])/1000 "KBps " (trans[2]-trans[1])/1000 " KBps"}' <(cat /proc/net/dev | grep eno1 | awk -F' ' '{print $2 " " $10}'; sleep 1; cat /proc/net/dev | grep eno1 | awk -F' ' '{print $2 " " $10}')