Tuesday, July 09, 2013

Testing for Download Speed

I've been on the Internet since about 1991, when I got my first email address and found myself corresponding with people across the world. I started out with a 14.4k modem, then upgraded to a 56.6k modem and at that time, I thought that was pretty nice. In 2001, I got my first cable modem connection running at about 1.5 megabits per second. I loved how Windows Updates would download so fast then. Since then, things have changed.

That experience has made me susceptible to an ongoing fascination with download speeds. So, from time to time, I like to test my download speeds. Part of my desire to know the download speed arises out of curiosity, the "How cool is that!?!" factor, and to ensure that the ISP is doing their job.

Now I could jog on over to speedtest.net, but they tend to be somewhat inconsistent. I've also used the tools at DSLReports.com and they never seem to match speedtest.net. So, maybe I could just download a really large file like an Ubuntu ISO file, weighing in around 955 MB. During the download, I can click on the menu in Chrome (three little bars next to the last tab on top), select Downloads and observe the download in action. Chrome will report the speed there, as well. But even that can be inconsistent, probably due to some overhead.

In Linux, Mac and I believe Windows, there is a text based tool called wget. Wget is the tool to use to download pretty much whatever you want. You can download an entire website if you have the space and if the website permits you to do it. I like wget because it's a very clean download from the command line. There is no user interface overhead from Windows or Gnome, nor is there overhead from the browser. For example, I could type the following command:

wget http://cdimage.ubuntu.com/ubuntu-gnome/releases/13.04/release/ubuntu-gnome-13.04-desktop-i386.iso

And that would download the Gnome desktop version of Ubuntu. Notice the file extension is .iso, that is a CD/DVD file that can be burned to optical disk. When I run the command, the progress, speed and ETA are displayed until the download is complete, like so...


What's really cool about wget (besides about 100 other options to the command), is that when it's done, it displays the download time and average download speed. In the image above, we can see that the download rate was more than 6 MB/s (Megabytes per second). That is consistent with an advertised speed of 50 Mb/s (Megabits per second). The speed here averages a bit more.

I have also found that I can write these commands in shell script. For example, this is what I would write in Linux:
#!/bin/bash
cd /media/scott/ISOs
# wget http://www.mageia.org/en/downloads/get/?q=Mageia-3-LiveDVD-GNOME-x86_64-DVD.iso
wget http://cdimage.ubuntu.com/ubuntu-gnome/releases/13.04/release/ubuntu-gnome-13.04-desktop-i386.iso
Then I can run that file to do the download. Over time, I can add more commands to the file and keep a nice little list of places to go to download the file of choice. So I browse to the location where I want to download the ISO file. Then I copy the link to the ISO file and paste it into my script after the command, wget.

To keep from running the previous wget command (since I already have that ISO), I place a hash character (#) at the beginning of that line to mark it as a comment and keep it from running. One other option to consider for this script is to change the working directory. I have a collection of ISOs in a directory that is not on my main hard drive, so I added a command at the beginning of the script (after the "she-bang" at the very beginning) to change the working directory to the desired location. This way I don't have to copy it again to another location after downloading.

I have found that wget is faster and that storing the commands in a script makes for an easy reference for later. And I just like to watch the progress of the download.

I hope you have enjoyed this little tutorial.

No comments: