Test Internet/Connection Speed from Linux Command Line

See complete post of Test Internet/Connection Speed from Linux Command Line

Do you use Ubuntu Server? or have a VPS or Dedicated Server hosting that runs Linux which only can be accessed via Console/Command Line/SSH? I Do! And now i want to check whether if the hosting company give me correct package of dedicated bandwidth for my server…

Yes, most people would think about speedtest.net, the most popular and distributed internet/connection speed test in the world. But the problem is speedtest.net is using a website and my server cannot open a web page and run the test widget there… Fortunately there is a “speedtest-cli” built on python and support any operating system as long as can run python code.

First we need to get the python code from github (assuming your OS already have python):

imkrisna@myserver: ~$ mkdir tools
imkrisna@myserver: ~$ cd tools/
imkrisna@myserver: ~/tools$ wget -O speedtest https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py
imkrisna@myserver: ~/tools$ chmod +x speedtest

Now you already have the test script for your internet speed test. To just test using default settings (nearest server by ping):

imkrisna@myserver: ~/tools$ ./speedtest
Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from My Server Hosting (My Server IP)...
Selecting best server based on ping...
Hosted by PT. Telekomunikasi Indonesia (Jakarta) [4.32 km]: 15.02 ms
Testing download speed........................................
Download: 92.80 Mbit/s
Testing upload speed..................................................
Upload: 91.26 Mbit/s

Then how can i check about my dedicated international bandwidth? For example i want to test the server connection from Japan. That’s possible using –server=<SERVER_ID> where the ID can be retrieved from –list options. But the result list of server is very large and some lines may already not visible. Old linux trick, use “grep“:

imkrisna@myserver: ~/tools$ ./speedtest --list | grep Japan
811) GLBB Japan KK (Chatan, Japan) [4260.23 km]
251) World's Fastest Indian (Tokyo, Japan) [5787.44 km]
2725) Alocac, Inc. (Tokyo, Japan) [5787.44 km]
imkrisna@myserver: ~/tools$ ./speedtest --server=251
Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from My Server Hosting (My Server IP)...
Hosted by World's Fastest Indian (Tokyo) [5787.44 km]: 19.073 ms
Testing download speed........................................
Download: 6.24 Mbit/s
Testing upload speed..................................................
Upload: 2.33 Mbit/s

This post is based on ubuntu forum: http://askubuntu.com/questions/104755/how-to-check-internet-speed-via-terminal and all credits to the software is for our good guy, sivel (https://github.com/sivel)

One Thought on “Test Internet/Connection Speed from Linux Command Line

  1. Well, this test shows the actual speed of the internet connection as the online website also shows.

Leave a Reply

Your email address will not be published. Required fields are marked *

Post Navigation