We have already talked several times about how to mediate the speed of the connection through the browser, my favorite services being
Fast
and
Speedtest
. But this time I wanted to go a little further and focus on
measuring the speed of the internet connection using the terminal in Linux
.
In many cases we have to do this test to verify that there is no badly configured network parameter or that there is no incident with our internet provider. Taking advantage of the terminal is usually a comfortable option for those of us who are used to its use and with this tutorial it will also be for more inexperienced users.
Before moving forward, I must say that
in this tutorial we are going to show you how to perform a basic speed test
and tell you that these types of tests are always very relative, since both the client and the server will influence the speed measurement.
How to check the speed of the internet connection with the terminal in Linux.
The simplest method is to use the
wget
command, which
shows
us
during the download process the transfer speed at each moment and when it finishes, it shows us the average transfer speed
.
The command we will use as an example is
wget --output-document=/dev/null http://ovh.net/files/100Mb.dat
and we will see something similar to the following on the screen:
To perform this test, we must select a remote file to download. In the previous example, I used a 100MB file that puts the OVH company at our disposal for testing.
It
is
also
important to look at the geographic location of the server that hosts the test file
, since the smaller the distance between server and client, the better speed rates we will achieve. In the case of the previous example, the OVH file was located in France.
Below I show you a small collection of files for download tests and at the same time I indicate the location:
All files are at
least 100MB in size so that the test gives us the most accurate result possible
. On certain occasions, it is even advisable to resort to larger test files.
Checking the speed from the terminal with the speedtest-cli tool.
The previous method is totally valid and functional, but we have a tool written in Python that has been specially designed to be executed in the console, it is
speedtest-cli
.
Responsible for the development of this tool is
Matt Martz
, a Rackspace company worker. This is a Python script that we can find on
GitHub
for free.
If our system has Python 2.4 or higher already installed,
installing speedtest-cli
is as simple as executing the following commands:
wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
chmod +x speedtest-cli
Now, we will only have to execute the program with the command
./speedtest-cli
and
the script itself will automatically select the best server
(the closest to our location and with less ping)
to perform the speed test.
It will perform both a data download test, as well as upload or send data.
Obviously, the program allows us to include certain parameters to have greater control over the speed test properties. To know all the available options, I recommend using the help of the program by executing the command
./speedtest-cli -h
.