Linux: CLI Bandwidth Speedtest

There are several graphical websites which you can use to test your speed to the Internet, however at times we need to perform this test from the command line interface (CLI). In our environment this includes testing from our servers which do not have a graphical user interface (GUI).

Some searching around I came across a great little utility from Matt Martz which gives you command line access to speedtest.net

Head over to my GitHub account and download a copy for speedtest-cli.
https://github.com/KevinFairbanks/speedtest-cli

Install is optional or it can be ran directly from where you download it to, instructions are provided on the GitHub project.

Quick and Dirty Download: 

wget -O speedtest-cli https://raw.githubusercontent.com/KevinFairbanks/speedtest-cli/master/speedtest_cli.py

chmod +x speedtest-cli

 To run the default test simply use the following command:
./speedtest-cli

The default option will try to find the closest server to you and run a speedtest. To specify what server to use see the detailed usage options below.

Detailed Usage: 

kevin@laptop:~$ ./speedtest-cli -h
usage: speedtest-cli [-h] [--bytes] [--share] [--simple] [--list]
                     [--server SERVER] [--mini MINI] [--source SOURCE]
                     [--timeout TIMEOUT] [--secure] [--version]

Command line interface for testing internet bandwidth using speedtest.net.
--------------------------------------------------------------------------
https://github.com/sivel/speedtest-cli

optional arguments:
  -h, --help         show this help message and exit
  --bytes            Display values in bytes instead of bits. Does not affect
                     the image generated by --share
  --share            Generate and provide a URL to the speedtest.net share
                     results image
  --simple           Suppress verbose output, only show basic information
  --list             Display a list of speedtest.net servers sorted by
                     distance
  --server SERVER    Specify a server ID to test against
  --mini MINI        URL of the Speedtest Mini server
  --source SOURCE    Source IP address to bind to
  --timeout TIMEOUT  HTTP timeout in seconds. Default 10
  --secure           Use HTTPS instead of HTTP when communicating with
                     speedtest.net operated servers
  --version          Show the version number and exit

 

Example Output:

kevin@laptop:~$ ./speedtest-cli 
Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from Verizon FiOS (72.90.94.148)...
Selecting best server based on latency...
Hosted by Punk Media (Syracuse, NY) [10.07 km]: 19.791 ms
Testing download speed........................................
Download: 38.61 Mbit/s
Testing upload speed..................................................
Upload: 30.99 Mbit/s

 

Kevin Fairbanks

Kevin Fairbanks serves as the Chief Executive Officer of PinkTie Technology Group, LLC – a website development and digital marketing agency. Kevin runs the Veteran Entrepreneur Mastermind where he helps bring Veterans together to discuss business ownership. He’s involved in several community organization including serving as a board member for the Greater Cicero Chamber of Commerce. As the host of a weekly podcast, Remove Before Flight, Kevin teaches Veterans how to start, grow, or scale a business.

Short of being a father, serving in the United States Air Force was the most important period in Kevin’s life. It reinforced who he is today and complimented the values taught to him growing up by his parents.

During his service time, Kevin had the pleasure of traveling the world and seeing how other cultures lived both pleasant and unpleasant. During one of these missions he experienced injuries that ultimately led to my honorable discharge as a Service Disabled Veteran.