Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Instead of going to sites like, or others, I want to check my current Internet speed from the terminal on Ubuntu. How can I do it?

share|improve this question
The results I'm getting with speedtest-cli are vastly under what I get from speedtest-cli Download 18.27 Mbits/s Upload 3.43 Mbits/s Download 59.38 Mbits/s Upload 12.14 Mbits/s I can't consider speedtest-cli to be in any way a valid test of network speed. – user375058 Feb 3 '15 at 12:46
@user375058: The speedtest-cli uses the same servers (etc.) as You should consider the speedtest-cli and to be equivalent, just with a different front-end. I would be surprised if you get significantly different results consistently if they both use the same server. If they aren't using the same server, then you have no basis for comparison. Lastly, my results for both utilities vary by a factor of 2-4 from run to run. I suggest you test 2-4 servers, and perform 3–4 runs for each server and compare tools. – jvriesem Oct 26 '15 at 22:33
@user375058: I actually just did what I suggested. See the link in my comment below for my results. – jvriesem Oct 27 '15 at 0:06

12 Answers 12

up vote 233 down vote accepted

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)

wget -O speedtest-cli
chmod +x speedtest-cli


Retrieving configuration...
Retrieving server list...
Testing from Comcast Cable (x.x.x.x)...
Selecting best server based on ping...
Hosted by FiberCloud, Inc (Seattle, WA) [12.03 km]: 44.028 ms
Testing download speed........................................
Download: 32.29 Mbit/s
Testing upload speed..................................................
Upload: 5.18 Mbit/s
share|improve this answer
This doesnt seem to work properly. I have BT infinity 50bBit down and 20Mbit up. But the results show up as 0.53Mbit down and 0.2Mbit up. Huh? Incorrect decimal placing? using wget I get 4.27M/s (34Mbit) (some other server though)? – ppumkin Sep 2 '13 at 21:53
As it has already been stated here: Since speedtest-cli is a python application, it is much easier to install by doing: pip install speedtest-cli or: easy_install speedtest-cli Depending on how Python is installed on your system, you may need to be root to do the above. – CrandellWS Feb 9 '14 at 4:18
Confirming that speedtest-cli is broken. Doesn't show speeds above 1Mbps. Doesn't transfer any info when claiming to do so. – int_ua Sep 10 '14 at 0:32
This should really be the accepted answer...speedtest-cli is working fine for me; think @int_ua was either having compatibility problems or internet problems. – peelman Oct 30 '14 at 12:22
This should be the right answer. Speed test means download AND upload. First answer ONLY measures the download speed, which is NOT a full picture of your internet connection speed. Especially if you are hosting something on that machine! – Emil Borconi Jan 20 '15 at 14:14

try this on command line

wget --output-document=/dev/null

try this too

got it from above link

share|improve this answer
Could you plz explain what /dev/null stands for? – nutty about natty Apr 4 '13 at 11:14
It is speacial file which simply the delete data written to it, – Tachyons Apr 4 '13 at 12:24
For me on Ubuntu 14.10 with python 2.7.8 the command wget --output-document=/dev/null works much better than using speedtset-cli the later seems to freeze and ^C fails to interrupte the command. With wget I have no problems cutting the download shrot with ^C – Willoczy Nov 27 '14 at 20:50
@mlissner, looks like first speed in megabits, second in megabytes.. – vp_arth Aug 14 '15 at 11:19

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 would start to download the Ubu1.avi file and show at what speed it is downloading.

enter image description here

Of course there are several recommendations:

  1. 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.

  2. 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.

  3. 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.

  4. 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.


This is an alternative to wget. The downside of wget is the lack of parallel connections. To use aria2 we fist need to download it:

   sudo apt-get install aria2

To use it is simple:

enter image description here

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:

enter image description here

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.

share|improve this answer
wget is not (yet) able to do a segmented download, that is to download a single file using multiple (parallel) connections, so if your ISP is limiting the speed per 1 connection, you won't get accurate results... it would be a more precise test to use some other tool, that can at least use segmented download (like aria2) – Mladen B. Aug 7 '13 at 9:21
@MladenB. Thanks. Added Aria2 to it. – Luis Alvarado Aug 7 '13 at 10:10
This is NOT a speedtest, this is a DOWNLOAD speed test only! Internet speed test means down&up load! Second answer, and all others mentioning speedtest-cli have the correct approach. – Emil Borconi Jan 20 '15 at 14:16
@EmilBorconi You are correct but in real life, we are not doing benchmarking Internet speeds here, this are just your average current speed tests of any home user without the need for sites like speedtest. A download speed (Which is enough for anyone trying to see if they are having a bottleneck) is a good enough test. A full down/up speed test would check what the full scope of your speed is based on your ISP. So yeah that would be the best solution, but for any fast test scenario, even a simple wget would do the trick since normally people worry more about download speed than upload. – Luis Alvarado Jan 20 '15 at 16:32
@LuisAlvarado sorry if I sounded rude, just I think people should be able to fully understand what they are asking / and what is the accepted answer. Lot's of newbies will look at forums and they will assume / pick / stop at the accepted answer, and they form a false image in their had. And yes download is more important then upload unless you are a facebook maniac who post selfies each 5 minutes, then start a fight with you ISP just because you tested the download which is good, but you have a crappy upload... Once again sorry if my tone was rude, did not want to insult... – Emil Borconi Jan 21 '15 at 9:52

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)

 user@server$ iperf -s

(on the client)

 user@client$ iperf -c server.domain
 Client connecting to, TCP port 5001
 TCP window size: 16.0 KByte (default)
 [  3] local port 52143 connected with port 5001
 [ ID] Interval       Transfer     Bandwidth
 [  3]  0.0-10.0 sec    113 MBytes  94.7 Mbits/sec

More Details

share|improve this answer
+1 iperf is fantastic for validating ethernet and WIFI speeds – kfmfe04 May 22 '13 at 10:19

Since speedtest-cli is a python application, it is much easier to install by doing:

pip install speedtest-cli


easy_install speedtest-cli

Depending on how Python is installed on your system, you may need to be root to do the above.

share|improve this answer

Install speedtest-cli

sudo apt-get install python-pip
sudo pip install speedtest-cli

Use it


if you want to upgrade it

sudo pip install speedtest-cli --upgrade
share|improve this answer

Run several instances of wget with timeout command on large files:


timeout 5 wget -q url_1/ &
timeout 5 wget -q url_2/ &
timeout 5 wget -q url_3/ &
timeout 5 wget -q url_4/speech.mp4 &

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).

share|improve this answer
This would require of some server set up... – Braiam Sep 20 '13 at 3:06
url_1,2,3,4 can be anything, such as public servers. – rexis Sep 20 '13 at 3:27
for example timeout 5 wget -O /tmp/temp5sec then analyze the filesize and devide by 5: expr $(stat --printf="%s" /tmp/temp5sec) / 5 / 1024 in kbit/s – rubo77 Aug 29 '15 at 11:49

Install the python script/broad band test:

wget -O /tmp/
chmod +x /tmp/

after type speedtest in terminal, enjoy the show.


share|improve this answer

you can use tespeed . it is a Terminal network speed test that uses servers from It uses nearest test server but can also use one manually specified by the user.

 git clone git://
 cd tespeed
 git submodule init
 git submodule update

enter image description here

for more info use :

 ./  -h

it will provide more option for speed test.

share|improve this answer

You can also try

They use curl (which is a well known command line utility) to run a speed test.

In short

wget && chmod u+x && bash

share|improve this answer

a simple one-liner that tests how long it takes to download 100MB (works on /bin/sh also):

t=$(date +"%s"); wget -O ->/dev/null ; echo -n "MBit/s: "; expr 8 \* 100 / $(($(date +"%s")-$t))


  1. store the timestamp in $t
  2. download 100mb but don't store anything
  3. calculate 8 * 100mb / $t

Note: gives a faster download, so it seems like does only offer 30 MBit/s max.

The problem in my OpenWRT console is that I cannot access which is strange

To check an ipv6 connection use

share|improve this answer

Simple bash script based on @rexis answer. You can put your own links for testing in links array or read them from file

export LC_ALL=C  #make output in English eg for later use with "du | grep"


rm -rf $TMP_PATH && mkdir $TMP_PATH

links=("" "" "" "" "" "")

echo "Testing download"

for link in ${links[*]}
    timeout $TEST_TIME wget -q -P $TMP_PATH $link &


total_bytes=$(du -c $TMP_PATH | grep total | awk '{print $1}')

echo "Cleaning up"
rm -rf $TMP_PATH

speed=$(expr $total_bytes / $TEST_TIME)

echo "Speed is $speed Kb/s"

exit 0
share|improve this answer
one minus - what about when i use other language as English ? see: grep :) part – ceph3us Mar 14 at 16:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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