Command Line Testing Internet Bandwidth Using Python

Speedtest.net is a go to site for testing Internet speeds, which is usually accomplished through a web browser. There is a command line utility that offers the functionality without the need of a GUI or the web browser.

cd /opt
wget https://github.com/sivel/speedtest-cli/archive/master.zip
unzip master.zip
cd speedtest-cli-master/
chmod +x speedtest_cli.py
./speedtest_cli.py
mv speedtest_cli.py /usr/bin/

To run the utility, type speedtest_cli.py. Here is an example of what one may expect to see.

[root@localhost speedtest-cli-master]# speedtest_cli.py
Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from Cox Communications (10.10.10.10)...
Selecting best server based on latency...
Hosted by BroadAspect (Washington, DC) [11.24 km]: 21.328 ms
Testing download speed........................................
Download: 17.78 Mbit/s
Testing upload speed..................................................
Upload: 12.27 Mbit/s

For help, type speedtest_cli.py -help.

[root@localhost speedtest-cli-master]# speedtest_cli.py --help
usage: speedtest_cli.py [-h] [--bytes] [--share] [--simple] [--list]
                        [--server SERVER] [--mini MINI] [--source SOURCE]
                        [--timeout TIMEOUT] [--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
  --version          Show the version number and exit

Source(s)
http://www.tecmint.com/check-internet-speed-from-command-line-in-linux/
https://github.com/sivel/speedtest-cli
http://lintut.com/test-internet-speed-from-linux-command-line/
http://www.unixmen.com/check-internet-speed-terminal-using-speedtest-cli/