738

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?

kernel_panic
  • 11,732
  • 5
    The results I'm getting with speedtest-cli are vastly under what I get from speedtest.net speedtest-cli Download 18.27 Mbits/s Upload 3.43 Mbits/s speedtest.net 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. –  Feb 03 '15 at 12:46
  • 3
    @user375058: The speedtest-cli uses the same servers (etc.) as SpeedTest.net. You should consider the speedtest-cli and www.speedtest.net 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 00:06
  • 2
    sudo apt install speedtest-cli – ColdCold Sep 30 '16 at 02:13

16 Answers16

1179

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)

curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -

Output:

Retrieving speedtest.net configuration...
Retrieving speedtest.net 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

Update in 2016:

speedtest-cli is in Ubuntu repositories now. For Ubuntu 16.04 (Xenial) and later use:

sudo apt install speedtest-cli
speedtest-cli

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.

speedtest-cli

Update in 2022:

sudo apt install speedtest-cli
speedtest-cli --secure
Tms91
  • 365
mweisel
  • 11,930
  • Can you summarize the important information from your blog post in your answer? – Eliah Kagan Mar 19 '13 at 08:36
  • The blog post is just an explanation about the program and how to install it. The program is a tool for measuring speed just like speedtest.net does, using the same servers (and automatically location the nearest). – fiatjaf Jul 04 '13 at 00:23
  • 4
    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)? – Piotr Kula Sep 02 '13 at 21:53
  • Installing git might be overkill for most Ask Ubuntu readers. You can just download the repo from https://github.com/sivel/speedtest-cli/archive/master.zip – brianpeiris Oct 09 '13 at 08:45
  • 39
    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 09 '14 at 04:18
  • Here is a simple bash script I wrote for handy tool, using notify-send and zenity to display the output graphically instead of terminal: http://ubuntuone.com/49YdNJBRtYIdaS1eY8jrpw – Sadi Feb 26 '14 at 08:29
  • 2
    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 00:32
  • 6
    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
  • After using pip install speedtest-cli to install the script and then running it with speedtest-cli the scrit seems to freeze up while at the line Testing download speed................ How long should this test take? It has been over 40 min now, while I was waiting I used speedtest.net and measured ping at 75ms, download speed at 6.36Mbps, and upload speed at 0.98Mbps. I am using Ubuntu 14.10 with python 2.7.8 – Willoczy Nov 27 '14 at 20:42
  • 2
    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
  • 1
    how can we select a server? I know of servers that can go beyond gigabit speeds. – jemiloii Jul 23 '15 at 15:59
  • Very nice blog post about command line usage for speetest-cli. Thanks! – Danilo Ramirez Sep 12 '15 at 20:05
  • thank you for the elegant code and support for python 3 and 2. ! – Rui Botelho Oct 06 '15 at 22:32
  • 1
    @JemiloII: To get a list of all SpeetTest.net servers, type ./speedtest-cli --list (use grep to find the server you're thinking of). It returns servers in the format XXXX) Company Name (Location, State/Province/Country) [DDD.DD km], where XXXX is the server ID (numeric) and DDD.DD is the estimated distance in kilometers from your machine. Then, to perform the test with a given server, type ./speedtest-cli --server XXXX, using the same numeric server ID you found in the previous step. – jvriesem Oct 26 '15 at 23:14
  • @Willoczy: it takes 5-25 seconds for me. In the SpeedTest.net web page, it sometimes complains that there's a missing Latency File. I don't know what's going on, but that message seems to exist for certain servers. I'd choose a different server manually. Perhaps the one you were using was having issues? – jvriesem Oct 26 '15 at 23:16
  • 1
    @int_ua: I can partially confirm that it is broken. I ran 3 tests via Speedtest.net and the speedtest-cli tool for 8 servers across North America. My results are tabulated here. There is a significant, systematic difference between the two approaches. That said, in about half the cases, it's not off by a very significant amount...but half the time it is. The biggest finding was that the upload speeds were consistently lower (usually 50-70% the speed) in the speedtest-cli run than the browser version. Odd. – jvriesem Oct 27 '15 at 00:04
  • 1
    The problem is still there in 2016. I did a few tests and have results similar (in nature) to those of @jvriesem. It is a pity as the tool would be very useful. I am wondering whether it can be used for comparisons (say, a few VPN servers - it would not really matter to know how fast they are but rather to be able to predictably compare them to get the fastest one) – WoJ Feb 23 '16 at 18:00
  • You can also skip the chmod command and just run python speedtest-cli. – Simon Woodside Jun 16 '16 at 05:08
  • sudo apt install speedtest-cli – ColdCold Sep 30 '16 at 02:14
  • Don't work for me. Tested on Linux Kali 4.3.0-kali1-amd64 #1 SMP Debian 4.3.3-7kali2 (2016-01-27) x86_64 GNU/Linux with Python 2.7.13. With and without root previllages, the resuld is 0.00 D and 0.00 U speed. I even selected server using speedtest-cli --server XXXX – ioaniatr Mar 15 '17 at 12:47
  • not good for testing high speed connections – Riccardo Cossu Jul 06 '17 at 08:01
  • I have a 1000Mbps connection, gives me 7Mbps down 0.2Mbps up, I follow the test with my system updates, it dowloads it at 24Mbps... I tried both the command line and speedtest-cli – Memes Jul 19 '17 at 05:02
  • For me the python script works better than the speedtest-cli. I have tested on the same machine, with python script I got 93MB/92MB (almost the same for 3 different tests) and with speedtest-cli I got 91MB/32MB. – luongnv89 Oct 09 '17 at 14:54
  • 2018 Uprdate: speedtest-cli installed from Ubuntu repositories works as speedtest.net – RickB Jun 08 '18 at 00:27
  • 760 Mbit/s down, 698 Mbit/s from the apt-get install method. Seems to work fine. – Diesel Oct 27 '19 at 16:01
  • Confirming that it's possible to consistently get a 1-4 Mbit/s with speedtest-cli, while getting 1500+ Mbit/s using the Python script piped from curl. The Python script it pulled directly from the GitHub master branch, so it likely has some bug-fixes that aren't in the ubuntu repos. speedtest-cli works fine on one of my machines (it is running Ubuntu 20.04), but not on the other (18.04). I don't know if it has to do with the Ubuntu version. Just be weary if you see very low numbers. – joe Aug 05 '20 at 00:46
  • curl command provided works good for devices where we do not want to install any extra applications, however small they may be. – angisl May 05 '21 at 19:14
  • If you want to log speed test info with date and time, I like to do this bash one liner: while :; do; echo "$(date): $(curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python3 - --simple | tr '\n' ' ')"; done 2>&1 | tee ~/speed_test_log.txt – openCivilisation Apr 15 '22 at 23:43
  • 1
    Can someone edit and change python to python3? – Madiyor Aug 28 '22 at 09:03
146

try this on command line

wget --output-document=/dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip

try this too

sourceforge.net/projects/tespeed/

got it from above link

henrique
  • 437
Tachyons
  • 17,281
  • 4
    Could you plz explain what /dev/null stands for? – nutty about natty Apr 04 '13 at 11:14
  • 18
    It is speacial file which simply the delete data written to it, – Tachyons Apr 04 '13 at 12:24
  • http://en.wikipedia.org/wiki//dev/null – nutty about natty Apr 04 '13 at 12:38
  • 2
    For me on Ubuntu 14.10 with python 2.7.8 the command wget --output-document=/dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip 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
  • Definitely not a good test for me. speedtest-cli gave a speed of about 12MB/s. This gave about 1.5MB/s. – mlissner Jul 21 '15 at 17:12
  • 1
    @mlissner, looks like first speed in megabits, second in megabytes.. – vp_arth Aug 14 '15 at 11:19
  • 1
    @mlissner 1.5 x 8 =12 . one is kbps and other is KBps :-) – Tachyons Aug 17 '15 at 09:57
  • 1
    Note that the test file is a 500 MB file. You can change the test500.zip to test10.zip (for example) to try a 10 MB file. I hear this also works with 100 MB. – jvriesem Oct 26 '15 at 22:26
  • 1
    Also, note that this only tests download speed, not upload. speedtest-cli seems like a better option. – Nathan F. Oct 19 '16 at 21:51
  • ./tespeed.py is working fine, although i would prefere speedtest-cli if it was working properly. But, beware to download files inside "SocksiPy" also. Tespeed is testing connection download and upload speed by using specific file sizes. – ioaniatr Mar 15 '17 at 16:47
  • 3
    Note that speedtest.wdc01.softlayer.com is just one specific Speedtest server. There are thousands of them all over the world, and depending on where you are located, testing with this one may or may not give you correct results. Speedtest.net choses the server closest to you automatically, which should be more relevant. Ideally, you should use your browser's Dev Tools to figure out the hostname/URL speedtest.net choses in your case and use that in the wget line above instead of speedtest.wdc01.softlayer.com. – Kibber Mar 21 '18 at 08:42
  • I had to test the speed of a docker container which did not have wget. This worked: curl --output /dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip – Niels Prins Nov 09 '21 at 18:00
  • On the Ubiquity AP I just had to speed test from, wget was not available, but instead, curl -o /dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip worked - not with an overwhelming performance. – Kristian Dec 05 '22 at 21:18
  • 1
    Is that softlayer server link still up? I can't seem to access it, no response coming back, hangs when try the URL in browser or via wget – David Sep 21 '23 at 02:08
  • @David I confirm that the reported URL is down also for me. – Valerio Bozz Dec 21 '23 at 09:22
  • I'm updating the question to keep this exact solution but with the URL https://www.ip-toolbox.com/speedtest-files/ that seems more reliable and it's online at the time of writing – Valerio Bozz Dec 21 '23 at 09:26
83

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 192.168.1.1, TCP port 5001
 TCP window size: 16.0 KByte (default)
 ------------------------------------------------------------
 [  3] local 192.168.1.3 port 52143 connected with 192.168.1.1 port 5001
 [ ID] Interval       Transfer     Bandwidth
 [  3]  0.0-10.0 sec    113 MBytes  94.7 Mbits/sec

More Details

One Zero
  • 27,153
  • 26
  • 88
  • 109
  • 7
    +1 iperf is fantastic for validating ethernet and WIFI speeds – kfmfe04 May 22 '13 at 10:19
  • 4
    iperf is great for LAN but the user is asking about WAN. – IMTheNachoMan Sep 11 '18 at 12:22
  • 3
    Those of you who don't have a remote server you can connect to, there are publicly available iperf servers: https://iperf.cc/ – Dominykas Mostauskis Oct 14 '19 at 10:28
  • 3
    speedtest is useless as most internet providers know their servers' addresses and prioritize them. I get results with iperf that are a 10th of what speedtest gives me. And those are the effective speeds I reach. – dargaud Mar 12 '20 at 18:36
  • 3
    @dargaud Make sure you don't mix TCP speed with UDP speed. Most speed test tools measure UDP speed, but iperf measures TCP by default. Use iperf -u -c servername to measure UDP speed. The results of that will probably be very close to what speedtest gives you. – not2savvy May 09 '22 at 09:45
  • If you want to test the WAN get a public server from the official site: https://iperf.fr/iperf-servers.php – HackSlash Jun 10 '23 at 04:12
39

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.

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.

ARIA2

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.

Luis Alvarado
  • 211,503
  • 1
    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 07 '13 at 09:21
  • @MladenB. Thanks. Added Aria2 to it. – Luis Alvarado Aug 07 '13 at 10:10
  • 4
    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
  • 2
    @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
  • 1
    @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 09:52
  • @EmilBorconi don't worry friend, we appreciate your feedback and they help anybody that reads this in the future. – Luis Alvarado Jan 21 '15 at 12:35
  • FYI, I had Axel (https://launchpad.net/ubuntu/+source/axel) installed already (using it for parallel connections), so it works fine for this purpose. – Vladimir Djuricic Aug 24 '15 at 11:30
  • 1
    I like wget better than curl for this because wget displays MB/s (very clear that is MBytes/s), whereas curl just displays k (not very obvious that it is KBytes/s). – wisbucky Sep 18 '19 at 22:48
  • aria2c -d /dev -o null --allow-overwrite=true --file-allocation=none -x 4 http://speedtest.wdc01.softlayer.com/downloads/test500.zip https://serverfault.com/a/526305/190486 – Akira Yamamoto Apr 01 '21 at 00:30
21

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.

BobC
  • 319
  • 2
  • 3
15

I'm regularly using something like this:

% wget -O /dev/null --progress=dot:mega http://cachefly.cachefly.net/10mb.test ; date
--2020-01-06 03:31:05--  http://cachefly.cachefly.net/10mb.test
Resolving cachefly.cachefly.net (cachefly.cachefly.net)... 2607:7700::18:0:1:cdea:afaf, 205.234.175.175
Connecting to cachefly.cachefly.net (cachefly.cachefly.net)|2607:7700::18:0:1:cdea:afaf|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10485760 (10M) [application/octet-stream]
Saving to: <</dev/null>>

     0K ........ ........ ........ ........ ........ ........ 30% 3.02M 2s
  3072K ........ ........ ........ ........ ........ ........ 60% 3.97M 1s
  6144K ........ ........ ........ ........ ........ ........ 90% 3.94M 0s
  9216K ........ ........                                    100% 3.99M=2.8s

2020-01-06 03:31:08 (3.62 MB/s) - <</dev/null>> saved [10485760/10485760]

Mon Jan  6 03:31:08 CST 2020
%

You can change the 10mb part in /10mb.test to 1mb, 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.

  • Can't comment yet; for very limited situations:
    echo    "Available file sizes (MB): 1, 4, 5, 10, 50, 100, 200, 400, 2000, 4000";
    read -p "Choice: " size;
    downloadUrl=http://cachefly.cachefly.net/${size}mb.test
    echo -e "\nDonwload url: ${downloadUrl}\n"
    startTime=$(date +"%s");
    wget  $downloadUrl -O ->/dev/null;
    endTime=$(date +"%s");
    totalTime=$(expr $(($endTime-$startTime)));
    echo -e "\nResults\n=======\nDownloaded in: $totalTime second(s)";
    echo "Speed: $(expr 8 \* $size / $totalTime) Mbit/s";```
    
    – cbaldan May 17 '22 at 20:23
12

I happen to like the speedometer Ubuntu cli.

speedometer -r eth0

To watch a live graph of incoming data speeds.

6ft Dan
  • 313
  • 1
  • 3
  • 9
7

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:

  1. store the timestamp in $t
  2. download 100mb but don't store anything
  3. calculate 8 * 100mb / $t
rubo77
  • 32,486
  • This worked great as I'm testing from a stateless read-only rootFS and wget wasn't outputting the speed. – vhs Jun 18 '18 at 18:31
  • As simple and barebones as it is, this might be the only option when you want to test connection speed but have limited Internet access to only one website. – undercat Mar 30 '20 at 10:28
4

Actually, Ookla, the provider of Speedtest released a command-line utility that is measuring your speed against a huge number of servers spread around the world. You can find instructions on how to install it on this link and you can use it fairly simple by executing:

speedtest -s XXXX -f csv|tsv|jsonl|json|json-pretty

where -s sets the server ID against which you want to test your Internet speed, -f is defining the format of the output. I think the most useful information is generated when you use json/json-pretty format for the output because a lot of the information of the test setup isn't printed if you are using the csv/tsv format. Both -s and -f are just optional but if you want to automate your measurement they might be useful.

In addition, you can find a list of the servers which speedtest is using on this address in the form of an XML file or on this address with a searchable field: link.

3

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

#!/bin/bash

timeout 5 wget -q url_1/100MB.zip &
timeout 5 wget -q url_2/file.zip &
timeout 5 wget -q url_3/sample.mov &
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).

Braiam
  • 67,791
  • 32
  • 179
  • 269
rexis
  • 31
  • 3
  • This would require of some server set up... – Braiam Sep 20 '13 at 03:06
  • url_1,2,3,4 can be anything, such as public servers. – rexis Sep 20 '13 at 03:27
  • for example timeout 5 wget http://speedtest.netcologne.de/test_100mb.bin -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
3

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

 git clone git://github.com/Janhouse/tespeed.git
 cd tespeed
 git submodule init
 git submodule update
 ./tespeed.py 

enter image description here

for more info use :

 ./tespeed.py  -h

it will provide more option for speed test.

pl_rock
  • 11,297
2

I wanted something more advanced than speedtest.net and various solutions that rely solely on a single website. So I did the thing I normally do and wrote my own solution:

https://github.com/cubiclesoft/network-speedtest-cli

From the features list:

  • SSH/SFTP (port 22) speed testing.
  • Common TCP ports 80, 443, and 8080 as well as random TCP port speed testing using a custom TCP/IP server that supports speeds up to 2.2 Gbps down and 780 Mbps up.
  • Fairly basic network latency testing.
  • Spin up Digital Ocean droplets and speed test SSH/SFTP and various TCP ports.
  • Speedtest.net and custom OoklaServer speed testing. Produces similar results to the single connection tests at single.speedtest.net.
  • Pure JSON output in silent mode (-s).

It's a more generic solution that can be consumed by other applications. I managed to pinpoint an ISP network issue with it that resulted in doubling my SFTP downstream speed, which resulted in increased happiness.

CubicleSoft
  • 131
  • 3
2

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

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

TMP_PATH=/tmp/speedtest_data/
TEST_TIME=5

rm -rf $TMP_PATH && mkdir $TMP_PATH

links=("http://client.cdn.gamigo.com/bp/eu/com/110a/BPClientSetup-2b.bin" "http://client.cdn.gamigo.com/bp/eu/com/110a/BPClientSetup-1b.bin" "http://client.cdn.gamigo.com/bp/eu/com/110a/BPClientSetup-1c.bin" "http://ftp.ntua.gr/pub/linux/ubuntu-releases-dvd/quantal/release/ubuntu-12.10-server-armhf+omap.img" "http://ftp.funet.fi/pub/Linux/INSTALL/Ubuntu/dvd-releases/releases/12.10/release/ubuntu-12.10-server-armhf+omap.img" "http://ftp.icm.edu.pl/pub/Linux/opensuse/distribution/13.2/iso/openSUSE-13.2-DVD-x86_64.iso")

echo "Testing download"

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

wait

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

echo "Cleaning up"
rm -rf $TMP_PATH

speed=$(echo "scale=2; $total_bytes / $TEST_TIME / 128" |bc)

echo "Speed is $speed Mbit/s"

exit 0
Kulfy
  • 17,696
Darkside
  • 141
1

To conveniently get my download speed in bits-per-second, I define the following in my $HOME/.bash_aliases file:

speed-test='wget --output-document=/dev/null --report-speed=bits http://speedtest.wdc01.softlayer.com/downloads/test500.zip'

where:

--output-document=/dev/null effectively discards the wget output

--report-speed=bits displays the wget download speed average in bits-per-second (bps) instead the default bytes-per-second (Bps)

trellem
  • 61
1

For charts + the 30,000 feet view of representative actual speeds

I was looking for:

  • A broad, multi-ISP, representative view of real-life speeds
  • Upload-speeds + round-trip latencies. Not just download speeds
  • Eliminate ISP bias and possible tricks they might play to make specific speed-tests appear faster than most other speeds are
  • High-level graphical output rather than just numbers. One picture is worth a 1000 words

Not being able to find anything that answered all these requirements, I wrote my own while avoiding reinventing the wheel wherever possible.

Under the hood, I used speedtest-cli for the ISP selection and the metrics, and R/ggplot for plotting. The code has been well tested on Ubuntu 16.04, 18.04 & 20.04.

The output provides the 3 main metrics (download, upload, and ping round-trip times) for the closest 20 data-centers to you (the tester), plus estimated distances and Internet provider names.

Source code

All the code is available from github with howto, examples & my story of looking for better speeds.

All this code is CLI based. The image viewer can also be called from the command line.

Example of the charts it generates

After a plan upgrade (DL-speeds are great, UL-speeds not so much)

results 2020-05-25

A manually annotated earlier test, testing a theory:

manually annotated earlier test

arielf
  • 2,823
1

You can also try http://dl.getipaddr.net

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

In short

wget https://raw.github.com/blackdotsh/curl-speedtest/master/speedtest.sh && chmod u+x speedtest.sh && bash speedtest.sh