Testing Your Bandwidth From The Command Line

Ever want a quick and dirty way to test your bandwidth from Terminal? Sometimes you just want to test your pipe without having to fuss with all the ads and Flash on sites like Speedtest.net. Now you can.

Prerequisite: If you wish to perform this test on a Mac, you'll want to install some sort of package manager so you can install and run wget. My preference is Homebrew, but MacPorts and Fink work just as well.

Open a Terminal window and copy/paste the following line of code. It will initiate a download of a ~500 MB file to /dev/null so you don't have to worry about deleting the file manually.

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

Linux users can use slightly cleaner code:

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

Next, watch the download fly (or crawl). Once the download starts you'll get a progress indicator that looks similar to screencap below. From left to right, it tells you: percentage complete, visual progress indicator, total bits transferred, current transfer rate, and time to completion.

After it's complete, you'll get a similar final tally as this: date/time completed, maximum transfer speed, location the transferred file is located on your local machine, and bit check (transferred/actual).

2014-04-12 16:54:21 (11.2 MB/s) - '/dev/null' saved [524288000/524288000]  

To convert the megabytes per second (MB/s) to a more relational transfer rate that your ISP uses, megabits per second (Mb/s), simply type the result into a Google search, with some such syntax like "11.2 MB/s to Mb/s" and the power of Google will perform the conversion for you:

Fin

Of course there are several factors at play here, namely:

  • The connection speed of the server.
  • The connection method of the client machine you're testing with (Ethernet or 802.11a/b/g/n/ac connection).
  • For those testing on a WLAN, any wireless interference.

It should be noted that this method will only test raw download speeds over your pipe and will not test for upload speeds (basically the inverse of this test) or the quality of your connection. There are other, more sophisticated tools you can use like Wireshark if you want to analyze the quality of your LAN.

Happy testing!