'Internet speed test from the command line'

9 years ago

Here's a neat trick: Measuring your Internet download speed from the command line.

Basically you need wget to download a big file (download to /dev/null will not waste disk space ;)) and simply check the average speed at the end.

Something like:

wget -O /dev/null http://speedtest.ams01.softlayer.com/downloads/test10.zip

Will give you:

Resolving speedtest.ams01.softlayer.com... Connecting to speedtest.ams01.softlayer.com||:80... connected. HTTP request sent, awaiting response... 200 OK Length: 11536384 (11M) [application/zip] Saving to: ‘/dev/null’ 100%[====================================================================================================================================================================================================================================>] 11,536,384 897KB/s in 13s 2013-09-05 17:36:36 (901 KB/s) - ‘/dev/null’ saved [11536384/11536384]

In this case, my download speed was 901KB/s.

But it gets better: Since you might not be near the server i am using to test, you can pick a closer one. Just replace the "ams01" part of the url with one of the [servers on this page](http://speedtest.ams01.softlayer.com/speedtest/). For simplicity, i've compiled a list:

- Amsterdam, The Netherlands: **ams01** (the one used in my test) - Singapore, Singapore: **sng01** - Seattle, USA: **sea01** - San Francisco, USA: **sjc01** - Dalas, USA: **dal01** - Dalas, USA: **dal05** - Dalas, USA: **dal07** - Houson, USA: **hou02** - Washington DC, USA: **wdc01**

So for example - if you live near San Francisco - use "http://speedtest.**sjc01**.softlayer.com/downloads/test10.zip" as the url (notice the change in bold).

**Bonus:** Create a shell alias and you can call the speed test anytime using - well - "speedtest". Here's an example for the FiSH shell and bash.

FiSH: Add to your **config.fish** function speedtest; wget -O /dev/null http://speedtest.ams01.softlayer.com/downloads/test10.zip; end

BASH: Add to your **.bash_profile** alias speedtest='wget -O /dev/null http://speedtest.ams01.softlayer.com/downloads/test10.zip'

Happy (fast) Interneting.