Instead of going to sites like speedtest.net, I want to check my current Internet speed from the terminal on Ubuntu. How can I do it?
Instead of going to sites like speedtest.net, I want to check my current Internet speed from the terminal on Ubuntu. How can I do it?
I recommend the speedtest-cli tool for this. I created a blog post (Measure Internet Connection Speed from the Linux Command Line) that goes into detail of downloading, installing and usage of it.
The short version is this: (no root required)
Output:
Update in 2018:
Using
pip install --user speedtest-cli
gets you a version that is probably newer than the one available from your distribution's repositories.Update in 2016:
speedtest-cli
is in Ubuntu repositories now. For Ubuntu 16.04 (Xenial) and later use:try this on command line
try this too
got it from above link
If you can't be bothered to install iperf , you could precede any command that shifts a known amount of data with the
time
command and do a sum.iperf is simple and easy to use.
It requires a client and server.
(on the server)
(on the client)
More Details
Well I use
wget
for it. That little tool tells me nicely what speed I have.To use it just point to a file in internet that is relatively bigger so that you can get a better estimate of it.
For example
typing:
wget http://hostve.com/neobuntu/pics/Ubu1.avi
would start to download the Ubu1.avi file and show at what speed it is downloading.Of course there are several recommendations:
Speed test yourself with good servers. In the case of my link the speed is less than 200KB so if you have a higher speed, the server will be the bottleneck for you, not your actual speed.
The highest speed you will see is the maximum speed that your connection and the server's connection can offer. If your connection is 512KB and the place where you are downloading is 400KB, your max connection will be 400KB because it is the max for the server you are downloading from.
You need to do the test at least 5 times to have a reliable speed check or at least do it for a minute or two. This will help you have a more accurate check.
You need to have at least 4 or 5 different testing sources to have a more accurate speed. Never test only from the same site as this can be affected by your distance to it, any problem in the server and the connections to it, etc. Always test from different servers.
ARIA2
This is an alternative to
wget
. The downside ofwget
is the lack of parallel connections. To use aria2 we fist need to download it:To use it is simple:
In the image, the -x 4 is how many parallel connections we wish to use. The CN parameter in the next line shows how many active parallel connections were permitted to download from that site. In this case CN is 4. But if we tried to have more connections we would get something like this:
We set 8 parallel connections but the site only allowed a maximum of 5 as shown by CN:5. This could be solved by the -j option which tells aria2c the maximum concurrent connections we want (Which by default is 5) but if the server has limited this, -j will not work.
Since speedtest-cli is a python application, it is much easier to install by doing:
or:
Depending on how Python is installed on your system, you may need to be root to do the above.
I'm regularly using something like this:
You can change the
10mb
part in/10mb.test
to1mb
,4mb
,5mb
,10mb
,50mb
,100mb
,200mb
,400mb
,2000mb
,4000mb
, and possibly some other values.You can also change the
--progress=dot:mega
part to--progress=dot:default
,--progress=dot:binary
,--progress=dot:mega
and--progress=dot:giga
; this setting helps you see how fast the download is going, and preserve more than a single reading over the whole duration of the download, which is helpful for when you need to share the results with someone, or just save it for your own records as a sort of a graph.I happen to like the
speedometer
Ubuntu cli.To watch a live graph of incoming data speeds.
a simple one-liner that tests how long it takes to download 100MB (works on
/bin/sh
also):t=$(date +"%s"); wget http://speedtest.tele2.net/100MB.zip -O ->/dev/null ; echo -n "MBit/s: "; expr 8 \* 100 / $(($(date +"%s")-$t))
explanation:
8 * 100mb / $t
Run several instances of wget with timeout command on large files:
And then write a script to calculate the total bytes downloaded and divide 5 seconds you will get a bytes/sec figure. Should be quite accurate and you can add more instances to max your bandwidth.
I have yet to test the full script but the single line command "timeout 5 wget url" works, and you get a partially downloaded file as a result (if 5 secs is not enough to complete the download).
you can use
tespeed
. it is a Terminal network speed test that uses servers fromSpeedtest.net
. It uses nearest test server but can also use one manually specified by the user.for more info use :
it will provide more option for speed test.