Use the command line tool Speedtest-CLI to test your upstream/downstream network speed
We often need to check whether the network between the home and the Office is connected. What should we do? Open the website Speedtest.net and start the test. The website loads JavaScript scripts in the browser, selects the best server speed measurement, and uses Flash to generate graphical results.
What about remote servers? You need to know that most remote servers do not have a browser to open the web page. This is where you can open the bottleneck of Web Page speed in your browser. You cannot perform regular tests on your servers as planned. In this case, you need a software named Speedtest-cli to break this bottleneck. It allows you to test the speed of Internet connection through the command line.
What is Speedtest-cli?
This program is a script program developed based on Python. It uses the speedtest.net service to measure the upstream and downstream bandwidth. Speedtest-cli can list the speed Servers Based on the physical distance from the data center to the speed server, or speed the servers. It can also generate a URL for you to share your speed results.
To install the latest version of speedtest-cli on Linux, you must install Python 2.4-3.4 or later.
Install speedtest-cli on Linux
You can install speedtest-cli in two ways. The first method is requiredpython-pip
Package Manager. The second method requires installing the Python script, generating the installation file, and then running it. here we will introduce two methods:
Install speedtest-cli using pythin-pip
First you need to installpython-pip
Package Manager, and then you can use the pip command to install speedtest-cli
$ sudo apt-get install python-pip
$ sudo pip install speedtest-cli
To upgrade speedtest-cli to the latest version, enter the following command:
$ sudo pip install speedtest-cli --upgrade
Install speedtest-cli using the Pyhton script
First, use the wgetcommand to extract the downloaded file (master.zip) from github)
$ wget https://github.com/sivel/speedtest-cli/archive/master.zip
$ unzip master.zip
After extracting the file, go to the extracted directory.speedtest-cli-master
Then the script can be executed.
$ cd speedtest-cli-master/
$ chmod 755 speedtest_cli.py
Next, move the executable script/usr/bin
Folder so that you do not have to enter the complete script path every time.
$ sudo mv speedtest_cli.py /usr/bin/
Use speedtest-cli to test the Internet connection speed
1. To test your download and upload speed, you only need to runspeedtest-cli
Command without parameters.
$ speedtest_cli.py
Test the upload/download speed in Linux
2. Test the upload/download speed (in bytes)
$ speedtest_cli.py --bytes
Test bytes speed
3. The tool provides a link to download images generated by your broadband test results. You can share them with your family and friends.
Share speed test results
The following figure shows the image generated by speed test using the command line above.
Speed Test Result
4. If you only need to Ping, upload, and download the results, run the following command:
$ speedtest_cli.py --simple
Test Ping, upload, and download speeds
5. Listspeedtest.net
All servers are physically located in kilometers (km)
$ speedtest_cli.py --list
List servers of Speedtest.net
6. After obtaining a very long list of servers, how can I list a server I want? What if I want to find the server in Mumbai (India) in the speedtest.net server list?
$ speedtest_cli.py --list | grep -i Mumbai
List the most recent servers
7. Speed the specified server. We use the server ID obtained in Example 5 and Example 6 above:
$ speedtest_cli.py --server [server ID]
$ Speedtest_cli.py -- server [5060] # Here we use server ID 5060 as an Example
Measure the speed of a specified server.
8. Outputspeedtest-cli
Version information and help documentation
$ speedtest_cli.py --version
Output version number
$ speedtest_cli.py --help
Output help document
Note: The latency in the report is not the exact result and should not be too dependent on it. This value can be regarded as relative latency, which is reliable for you to choose a test server. At the same time, the CPU and memory capacity will affect the accuracy of the results.
Conclusion
System Administrators and developers should have to use this simple script tool. This lightweight tool has complete functions and is really awesome. The reason why I don't like Speedtest.net is that it uses flash. On the contrary, speedtest-cli just marked my pain points.
Speedtest_cli is a third-party tool and cannot automatically record the bandwidth speed. Speedtest.net has millions of users. You can create a small speed server by yourself.
The above is all content. For more information, please stay tuned to us. If you have any feedback, remember to comment at the bottom of the Article. If you like, don't forget to give us a thumbs up and share our article.
Via: http://www.tecmint.com/check-internet-speed-from-command-line-in-linux/
Author: Avishek Kumar Translator: NearTan Proofreader: wxy
This article was originally translated by LCTT and launched with the Linux honor in China
This article permanently updates the link address: