How to test network transfer speed on Linux?

In Linux, there are various commands and tools available to test network transfer speeds, such as:

  1. To use the iperf command: iperf is a network performance testing tool that can be used to test network bandwidth, latency, and packet loss information. You can install it by entering the following command in the terminal:
  2. To install iperf, use the following command in the terminal: sudo apt-get install iperf
  3. After installation, you can run an iperf server on one machine and an iperf client on another machine to test network transmission rates by specifying the server’s IP address and port number. For example, run the following command on the server:
  4. Run the iperf server.
  5. Run the following command on the client side:
  6. iperf -c
  7. The current network transfer rate will be displayed after running.
  8. To make use of the netcat command: Netcat is a network tool that can be used for network transmission and testing network transfer rates. You can install it by entering the following command in the terminal.
  9. Please install netcat using the command sudo apt-get install netcat.
  10. After installation is completed, run the following command on a machine as the server:
  11. Listen for connections on a specific port and send the output (if any) to /dev/null.
  12. Run the following command on another machine as a client:
  13. Copy 1,000 blocks of zeros from /dev/zero and send them to the specified server IP address and port using netcat.
  14. After running, it will display the current network transfer speed.
  15. To utilize the speedtest-cli tool: speedtest-cli is a command-line tool based on Python, used to test the upload and download speeds of a network. To install, input the following command in the terminal:
  16. Please install speedtest-cli using sudo apt-get.
  17. After installation is complete, run the following command to test the network transfer speed:
  18. CLI Speed Test
  19. After running, it will display the current network upload and download speeds.

The methods can all test network transmission speed, the specific choice of method will depend on the requirements and actual circumstances.

bannerAds