Hello, I’m Liang Xu.

No matter what operating system you’re running, Internet speed is one of the performance metrics you care about a lot. After all, you don’t want to watch a video that makes you doubt your life. This article introduces three network speed measurement tools from the Linux command line to keep you informed of the state of your network anytime, anywhere.

fast

Fast is a Service provided by Netflix that can be used not only from the command line, but also directly on the Web: fast.com.

We can install the tool by using the following command:

$ npm install --global fast-cliCopy the code

It provides the most basic network download speed, both on the web and on the command line. The simplest way to use the command line is as follows:

$fast 93 Mbps ↓Copy the code

As you can see from the above results, using the fast command directly will only return the network download speed. If you also want to get the network upload speed, use the -u option.

$fast -u ⠧ 81 Mbps ↓ / 8.3 Mbps ↑Copy the code

speedtest

Speedtest is a better known tool. It is written in Python and can be installed using apt or PIP commands. You can use it from the command line or import it directly into your Python project.

Installation method:

$sudo apt install speedtest-cli $sudo pip3 install speedtest-cliCopy the code

To use the speedtest command, run the speedtest command:

$ speedtest Retrieving speedtest.net configuration... Testing from Tencent Cloud Computing (140.143.139.14)... Retrieving speedtest.net server list... Selecting best server based on ping... CMCC 5G (Zhengzhou) [9.69km]: 28.288 ms Testing the download speed... Download: 56.20 Mbit/s Testing the upload speed...................................................................................................... Upload: 1.03 Mbit/sCopy the code

As you can see from the results, the speedtest command provides the upload/download rate directly, and the test process is pretty fast. You can write a script to invoke this command, then perform regular network tests and save the results in a file or database so you can track your network status in real time.

2020 selected Ali/Tencent and other front-line big factory interview, resume, advanced, e-book public number “Liang Xu Linux” background reply “information” free access

iPerf

Iperf is a network performance testing tool that can test TCP and UDP bandwidth quality, can measure the maximum TCP bandwidth, has a variety of parameters and UDP features, can report bandwidth, delay jitter and packet loss. The iPERF feature can be used to test the performance of some network devices such as routers, firewalls, switches, etc.

Debian distributions can install iPerf using the following command:

$ sudo apt install iperfCopy the code

This tool works not only on Linux, but also on Mac and Windows.

If you want to test network bandwidth, you need two computers. The two computers need to be on the same network, one as a service machine and the other as a client, and both must have iPerf installed.

You can run the following command to obtain the SERVER IP address:

$IP addr show | grep inet. * BRD inet 192.168.242.128/24 BRD 192.168.242.255 scope global dynamic noprefixroute ens33Copy the code

We know that on lans, our ipv4 addresses start with 192.168. After running the above command, we need to write down the address of the server machine for later use.

After that, we start the iPERF tool on the server:

$ iperf -sCopy the code

Then, we can wait for the client to come in. The client can connect to the server machine using the following command:

192.168.242.128 $iperf - cCopy the code

After a few seconds of testing, it returns the network transmission rate and bandwidth.

2020 selected Ali/Tencent and other front-line big factory interview, resume, advanced, e-book public number “Liang Xu Linux” background reply “information” free access

All you see is true love. Why don’t you like it before you leave? Your “sanlian” is the biggest motivation for liang Xu’s continuous creation!

  1. Pay attention to the original public number “good Xu Linux”, the first time to get the latest Linux dry goods!
  2. Public number background reply [information] [interview] [resume] to get selected first-line big factory interview, self-improvement, resume and other information.
  3. Follow my blog: lxLinux.net