Lets say you are logged into a headless server (command line only) and you get a call about slow internet performance across network. Now of course there might be hundreds of reasons for slowness but you managed to narrow it down to the correction between your Gateway proxy and Upper stream provider. So, obviously before you call your Internet service provider and complain about slow connection you need to make sure exactly how slow the connection is right now. Ideally, if you were using a Desktop Manager, you could just fire-up a web browser and test your internet speed against sites like speedtest.net, or others. But you are in a headless server, no browser, no java, no flash. What to do? Well, fear not, you are using Linux and that means you can check download speed from Linux terminal easily. There are many different ways you can do it.

Option 1: Using speedtest-cli

First you need to install python-pip package

apt-get install python-pip

Next you install speedtest-cli via pip.

pip install speedtest-cli

Check internet speed from terminal in Linux - blackMORE Ops -1

and finally you just simply run speedtest-cli command in your terminal
Check internet speed from terminal in Linux - blackMORE Ops -2

Option 2: Using wget

To use it just point to a file in internet that is relatively bigger so that you can get a better estimate of it.
For example

typing: wget http://hostve.com/neobuntu/pics/Ubu1.avi would start to download the Ubu1.avi file and show at what speed it is downloading.
enter image description here
Of course there are several recommendations:

  1. Speed test yourself with good servers. In the case of my link the speed is less than 200KB so if you have a higher speed, the server will be the bottleneck for you, not your actual speed.
  2. The highest speed you will see is the maximum speed that your connection and the server’s connection can offer. If your connection is 512KB and the place where you are downloading is 400KB, your max connection will be 400KB because it is the max for the server you are downloading from.
  3. You need to do the test at least 5 times to have a reliable speed check or at least do it for a minute or two. This will help you have a more accurate check.
  4. You need to have at least 4 or 5 different testing sources to have a more accurate speed. Never test only from the same site as this can be affected by your distance to it, any problem in the server and the connections to it, etc. Always test from different servers.

Option 3: Using aria2

This is an alternative to wget. The downside of wget is the lack of parallel connections. To use aria2 we fist need to download it:

apt-get install aria2

To use it is simple:
enter image description here
In the image, the -x 4 is how many parallel connections we wish to use. The CN parameter in the next line shows how many active parallel connections were permitted to download from that site. In this case CN is 4. But if we tried to have more connections we would get something like this:
enter image description here
We set 8 parallel connections but the site only allowed a maximum of 5 as shown by CN:5. This could be solved by the-j option which tells aria2c the maximum concurrent connections we want (Which by default is 5) but if the server has limited this, -j will not work.


Check internet speed from terminal in Linux - blackMORE Ops -3I thought doing it from command line (no GUI = less junk) would make my connection work faster. I was wrong. I did a Speedtest from GUI from the same server and it gave me 65Mb/s instead of 55Mb/s. It was actually surprising to me. Not sure what to make of that result but I will leave it to the readers.
As for these three methods, surely there’s many more. If you found any particular methods useful, do let me know via comment section. Thanks for reading. If you’ve found it useful, share RT.