1. How to check Internet Speed via Terminal in Linux or Ubuntu?
The easiest way to test internet speed in Ubuntu terminal is installing and using speedtest-cli. You can check the detailed information in this blog regarding downloading, installing and usage of it.
$ pip install speedtest-cli
$ speedtest-cli
If you don’t want to install speedtest-cli then also you can directly use the below command in terminal to test your internet speed.
curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -
Remember speedtest-cli is built on python, so please make sure python is already installed in system.
2. How do you properly test the network speed between two Linux servers using terminal ?
Best way to test the network speed between two servers using terminal is installing and using iperf . iperf is a client server arrangement in that you run it in server mode at one end and connect to its from another computer on the other side of the network. You can check the iperf documentation.
Iperf 3 is the latest version of iperf. You can install the iperf directly from ubuntu repository using below command.
sudo apt-get install iperf3
You can also install the latest iperf version 3.1.3 (As of writing this article) using below commands.
sudo apt-get remove iperf3 libiperf0
wget https://iperf.fr/download/ubuntu/libiperf0_3.1.3-1_amd64.deb
wget https://iperf.fr/download/ubuntu/iperf3_3.1.3-1_amd64.deb
sudo dpkg -i libiperf0_3.1.3-1_amd64.deb iperf3_3.1.3-1_amd64.deb
rm libiperf0_3.1.3-1_amd64.deb iperf3_3.1.3-1_amd64.deb
In order to use this you need to install this on both servers. Once installed run the below command in one server to start the iperf.
iperf3 -s -p 2324 #use -s to start as server and -p for port no. you can use any free port no for this. In this example i'm using 2324.
You will get output like this.
ubuntu@ip-XXX-XX-X-XXX:~$ iperf3 -s -p 2324
-----------------------------------------------------------
Server listening on 2324
-----------------------------------------------------------
Next from another server run below command to test the network speed between two servers.
iperf3 -c XXX.XX.X.XXX #network address of 1st server
i.e.
iperf3 -c 192.168.1.1
You will get output something like this
ubuntu@another-server:~$ iperf3 -c XXX.XX.X.XXX -p 2324
Connecting to host XXX.XX.X.XXX, port 2324
[ 4] local XXX.XX.XX.XXX port 47740 connected to XXX.XX.X.XXX port 2324
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-1.00 sec 724 KBytes 5.93 Mbits/sec 0 38.2 KBytes
[ 4] 1.00-2.00 sec 1.07 MBytes 9.00 Mbits/sec 0 56.6 KBytes
[ 4] 2.00-3.00 sec 1.39 MBytes 11.6 Mbits/sec 0 66.5 KBytes
[ 4] 3.00-4.00 sec 2.17 MBytes 18.2 Mbits/sec 0 156 KBytes
[ 4] 4.00-5.00 sec 2.61 MBytes 21.9 Mbits/sec 0 259 KBytes
[ 4] 5.00-6.00 sec 2.86 MBytes 24.0 Mbits/sec 0 375 KBytes
[ 4] 6.00-7.00 sec 2.86 MBytes 24.0 Mbits/sec 0 491 KBytes
[ 4] 7.00-8.00 sec 2.92 MBytes 24.5 Mbits/sec 0 609 KBytes
[ 4] 8.00-9.00 sec 2.67 MBytes 22.4 Mbits/sec 0 725 KBytes
[ 4] 9.00-10.00 sec 2.11 MBytes 17.7 Mbits/sec 0 836 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-10.00 sec 21.4 MBytes 17.9 Mbits/sec 0 sender
[ 4] 0.00-10.00 sec 18.6 MBytes 15.6 Mbits/sec receiver
iperf Done.