Linux terminal: speedtest_cli detects your real-time bandwidth speed

Source: Internet
Author: User

Linux terminal: speedtest_cli detects your real-time bandwidth speed

How fast are you uploading and downloading at home (or in the office? Can you ensure that you get an equivalent return when you pay for the ISP?

To test the speed of our Internet connection, there are some Internet services, such as SpeedTest, which is a Web service that can be browsed by web browsers and mobile apps.

Now, you can easily detect your network speed. Using speedtest_cli is also very simple. It is a command line interface that uses speedtest.net to test Internet bandwidth. In this way, you can also perform bandwidth tests on servers without browsers or graphical interfaces.

Install

Speedtest_cli is a python script, so it is really easy to install and use. You can install it in many ways:

1) pip/easy_install

Open a terminal and enter the following command:

  1. Pip install speedtest_cli

Or

  1. Easy_install speedtest_cli
2) Github

To install the SDK directly from github, you must:

  1. Pip install git + https://github.com/sivel/speedtest-cli.git

Or

  1. Git clone https://github.com/sivel/speedtest-cli.git
  2. Python speedtest-cli/setup. py install
3) as a Ubuntu/Debian or Mint package

The getdeb repository provides the installation package. You can install the package easily by following the steps below:

  • Install the getdeb package

Or

  • Manual repository Configuration:

Go to system management software source, third-party software options, and add:

  1. Deb http://archive.getdeb.net/ubuntu trusty-getdeb apps

Add the warehouse GPG key, open the terminal window, and enter:

  1. Wget-q-O-http://archive.getdeb.net/getdeb-archive.key | sudo apt-key add-

Now, you can use the following command to install the speedtest_cli package:

  1. Sudo apt-get update
  2. Sudo apt-get install python-speedtest-cli
4) download (same as before)

In the last selection, you only need to download the python script and then run the script where you want to run it:

  1. Wget-O speedtest-cli https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py
  2. Chmod + x speedtest-cli

Or

  1. Https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py curl-o speedtest-cli
  2. Chmod + x speedtest-cli
Basic usage

You can run speedtest_cli.py without any options, and then you will get a report on your bandwidth speed on the terminal. This is my bad Italian Adsl output:

  1. $./Speedtest_cli.py
  2. Retrieving speedtest.net configuration...
  3. Retrieving speedtest.net server list...
  4. TestingfromTelecomItalia (87.13.73.66 )...
  5. Selecting best server based on latency...
  6. HostedbyLepidaSpA (Bologna) [12.20 km]: 104.347 MS
  7. Testing download speed ........................................
  8. Download: 6.35 Mbits/s
  9. Testing upload speed ..................................... ..........
  10. Upload: 0.34 Mbits/s

This is the basic usage. This is enough to let you know that your Internet connection is good or bad, but you may want to share this information with your friends, you only need to use the-share option.

  1. ./Speedtest_cli.py -- share
  2. Retrieving speedtest.net configuration...
  3. Retrieving speedtest.net server list...
  4. TestingfromTelecomItalia (87.13.73.66 )...
  5. Selecting best server based on latency...
  6. HostedbyLepidaSpA (Bologna) [12.20 km]: 93.778 MS
  7. Testing download speed ........................................
  8. Download: 6.20 Mbits/s
  9. Testing upload speed ..................................... ..........
  10. Upload: 0.33 Mbits/s
  11. Share results: http://img.linux.net.cn/data/attachment/album/201409/11/153414kpd6xpiqs278f4xd.png

This will generate an image similar to the following (but I hope the value in your image is better ):

  1. ! [] (Http://img.linux.net.cn/data/attachment/album/201409/11/153414kpd6xpiqs278f4xd.png)

Another interesting option is-list, which lists all speedtest.net servers by distance. The following is my running result:

  1. Retrieving speedtest.net configuration...
  2. Retrieving speedtest.net server list...
  3. 2872) LepidaSpA (Bologna, Italy) [12.20 km]
  4. 1561) mynetway s. R. L. (Cesena, Italy) [80.97 km]
  5. 2710) ReteIVOby D. t. s. Srl (Florence, Italy) [90.90 km]
  6. 4826) InteplanetSrl (Verona, Italy) [100.45 km]
  7. 3998) Wolnext srl (Verona, Italy) [100.45 km]
  8. 2957) Wifiweb s. r. l. (AltavillaVicentina, Italy) [103.11 km]
  9. 3103) E4A s. r. l. (Vicenza, Italy) [107.17 km]
  10. 3804) InterplanetSrl (Vicenza, Italy) [107.17 km]
  11. 1014) NTRnet (Vicenza, Italy) [107.17 km]
  12. 3679) Hynet s r l (Vicenza, Italy) [107.17 km]
  13. 3745) ComeserSrl (Fidenza, Italy) [114.00 km]
  14. 5011) Welcomeitalia spa (Massarosa, Italy) [119.26 km]
  15. 2864) ReteIVOby D. t. s. Srl (Massa, Italy) [120.92 km]
  16. 2918) ReteIVOby D. t. s. Srl (Arezzo, Italy) [129.79 km]
  17. ...

Now that I know the ID of the server around me, I can use the-server option to select a specific server, so to select a server located in Florence (ID 2710, run the following command:

  1. ./Speedtest_cli.py -- server 2710
  2. Retrieving speedtest.net configuration...
  3. Retrieving speedtest.net server list...
  4. TestingfromTelecomItalia (87.13.73.66 )...
  5. HostedbyReteIVOby D. t. s. Srl (Florence) [90.90 km]: 106.505 MS
  6. Testing download speed ........................................
  7. Download: 6.18 Mbits/s
  8. Testing upload speed ..................................... .........
  9. Upload: 0.35 Mbits/s

Published by Asapy Programming Company

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.