Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: Test Internet Speed from the Terminal on Ubuntu Linux  (Read 1723 times)

0 Members and 1 Guest are viewing this topic.

akhilt

  • Guest
Test Internet Speed from the Terminal on Ubuntu Linux
« on: August 11, 2018, 04:48:29 pm »
Test Internet Speed from the Terminal on Ubuntu Linux

We generally use flash based websites (like speedtest.net & whatismyip.com) to test our Internet speed but as Linux admin we love to test Internet speed from the command line or terminal.

speedtest.cli is command line tool which is used to test Internet bandwidth from the terminal on Linux like Operating system. In this post we will discuss how to install and use speedtest.cli on Ubuntu Linux.

Download the Script Speedtest.cli & assign Execute Permissions

Code: [Select]
# wget https://github.com/sivel/speedtest-cli/archive/master.zip
--2018-08-11 07:01:01--  https://github.com/sivel/speedtest-cli/archive/master.zip

# ll
total 36
drwxr-xr-x  2 root root  4096 Aug 11 07:01 ./
drwxr-xr-x 24 root root  4096 Aug 11 06:55 ../
-rw-r--r--  1 root root 27770 Aug 11 07:01 master.zip
-rw-r--r--  1 root root     0 Aug 11 06:55 speedtest-cli

# unzip master.zip
Archive:  master.zip
72ed585c6f9d19b39a80e0c9364592095d070f62
   creating: speedtest-cli-master/
  inflating: speedtest-cli-master/.gitignore 
  inflating: speedtest-cli-master/.travis.yml 
  inflating: speedtest-cli-master/CONTRIBUTING.md 
  inflating: speedtest-cli-master/LICENSE 
  inflating: speedtest-cli-master/MANIFEST.in 
  inflating: speedtest-cli-master/README.rst 
 extracting: speedtest-cli-master/setup.cfg 
  inflating: speedtest-cli-master/setup.py 
  inflating: speedtest-cli-master/speedtest-cli.1 
  inflating: speedtest-cli-master/speedtest.py 
   creating: speedtest-cli-master/tests/
   creating: speedtest-cli-master/tests/scripts/
  inflating: speedtest-cli-master/tests/scripts/source.py 
  inflating: speedtest-cli-master/tox.ini

# ll
total 40
drwxr-xr-x  3 root root  4096 Aug 11 07:01 ./
drwxr-xr-x 24 root root  4096 Aug 11 06:55 ../
-rw-r--r--  1 root root 27770 Aug 11 07:01 master.zip
-rw-r--r--  1 root root     0 Aug 11 06:55 speedtest-cli
drwxr-xr-x  3 root root  4096 May 24 12:06 speedtest-cli-master/

# ll
total 124
drwxr-xr-x 3 root root  4096 May 24 12:06 ./
drwxr-xr-x 3 root root  4096 Aug 11 07:01 ../
-rw-r--r-- 1 root root   232 May 24 12:06 .gitignore
-rw-r--r-- 1 root root  1247 May 24 12:06 .travis.yml
-rw-r--r-- 1 root root  1671 May 24 12:06 CONTRIBUTING.md
-rw-r--r-- 1 root root 11358 May 24 12:06 LICENSE
-rw-r--r-- 1 root root    35 May 24 12:06 MANIFEST.in
-rw-r--r-- 1 root root  5450 May 24 12:06 README.rst
-rw-r--r-- 1 root root    20 May 24 12:06 setup.cfg
-rw-r--r-- 1 root root  3277 May 24 12:06 setup.py
-rw-r--r-- 1 root root  2923 May 24 12:06 speedtest-cli.1
-rwxr-xr-x 1 root root 61423 May 24 12:06 speedtest.py*
drwxr-xr-x 3 root root  4096 May 24 12:06 tests/
-rw-r--r-- 1 root root   497 May 24 12:06 tox.ini



Now test Internet Speed by executing the below command:

Code: [Select]
# ./speedtest.py
Retrieving speedtest.net configuration...
Testing from Softcom Technology Consulting (xxx.xx.xx.xx)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by VMedia Inc (Toronto, ON) [2.92 km]: 30.739 ms
Testing download speed................................................................................
Download: 715.14 Mbit/s
Testing upload speed................................................................................................
Upload: 98.87 Mbit/s

Generate the result of Internet Speed in an Image hosted on speedtest.net

Code: [Select]
# ./speedtest.py --share
Retrieving speedtest.net configuration...
Testing from Softcom Technology Consulting (xxx.xx.xx.xx)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by VMedia Inc (Toronto, ON) [2.92 km]: 3.91 ms
Testing download speed................................................................................
Download: 904.91 Mbit/s
Testing upload speed................................................................................................
Upload: 10.86 Mbit/s
Share results: http://www.speedtest.net/result/7543683921.png


Go to Link  http://www.speedtest.net/result/7543683921.png, there you will see the result of your internet speed as an image as shown below.




Show the list of ‘speedtest.net’ Servers against which we can test Internet Speed.

Code: [Select]
# ./speedtest.py --list

Check Internet Speed against the Specific Server.

Code: [Select]
# ./speedtest.py --server 1777
Retrieving speedtest.net configuration...
Testing from Softcom Technology Consulting (xxx.xx.xx.xx)...
Retrieving speedtest.net server list...
Retrieving information for the selected server...
Hosted by Comcast (Winchester, VA) [504.68 km]: 75.547 ms
Testing download speed................................................................................
Download: 118.31 Mbit/s
Testing upload speed................................................................................................
Upload: 0.00 Mbit/s

Getting help and Options used in Speedtest.cli

Code: [Select]
# ./speedtest.py --help
usage: speedtest.py [-h] [--no-download] [--no-upload] [--bytes] [--share]
                    [--simple] [--csv] [--csv-delimiter CSV_DELIMITER]
                    [--csv-header] [--json] [--list] [--server SERVER]
                    [--exclude EXCLUDE] [--mini MINI] [--source SOURCE]
                    [--timeout TIMEOUT] [--secure] [--no-pre-allocate]
                    [--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
  --no-download         Do not perform download test
  --no-upload           Do not perform upload test
  --bytes               Display values in bytes instead of bits. Does not
                        affect the image generated by --share, nor output from
                        --json or --csv
  --share               Generate and provide a URL to the speedtest.net share
                        results image, not displayed with --csv
  --simple              Suppress verbose output, only show basic information
  --csv                 Suppress verbose output, only show basic information
                        in CSV format. Speeds listed in bit/s and not affected
                        by --bytes
  --csv-delimiter CSV_DELIMITER
                        Single character delimiter to use in CSV output.
                        Default ","
  --csv-header          Print CSV headers
  --json                Suppress verbose output, only show basic information
                        in JSON format. Speeds listed in bit/s and not
                        affected by --bytes
  --list                Display a list of speedtest.net servers sorted by
                        distance
  --server SERVER       Specify a server ID to test against. Can be supplied
                        multiple times
  --exclude EXCLUDE     Exclude a server from selection. Can be supplied
                        multiple times
  --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
  --no-pre-allocate     Do not pre allocate upload data. Pre allocation is
                        enabled by default to improve upload performance. To
                        support systems with insufficient memory, use this
                        option to avoid a MemoryError
  --version             Show the version number and exit

Hoping the information was useful, Thank you!