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
and finally you just simply run speedtest-cli command in your terminal
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.
Of course there are several recommendations:
- 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.
- 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.
- 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.
- 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:
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:
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.
Conclusion
I 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.
You can also use Axel for testing download speed in Linux :)
Very cool. Thank you for your continued support
This is interesting.
I’m on a fast cable here 100 mbs and when I run the Ookla speed test on Iceweasel, it is noticeably laggy and maxed out at 6.5 when I run this command line test I get between 80 and 84.
Iceweasel seems to be doing lots of things in the background all the time.
I really like this site. I’m a very old newbie to Linux and it is certainly shaking up my grey cells
I ike the way you write your guides. Easy to read with lots of screen shots I’ve put it in my favourites. Mostly they work.
Now to find how to remove Iceweasel it really is so slow compared to Mozilla I’ve got running on my Mint Linux