In this guide, we want to teach you to Check or Test Internet Speed in Linux Terminal. You can easily test your network data speed from the Linux command line by using Linux tools.
This tutorial will show you to use speedtest-cli and ping commands to test your internet speed on Linux.
How To Check Internet Speed in Linux Terminal?
To complete this guide, you must have access to your server as a root or non-root user with sudo privileges. For this purpose, you can visit the Orcacore website and search for our initial server setup guides.
Now proceed to the following steps to test your network speed on Linux.
Step 1 – Check Internet Speed From Linux Command Line with speedtest-cli
The speedtest-cli is a Python tool that can be used to test Linux internet speeds. With this tool, you can test your internet upload and download speeds, and measure ping.
To use this too, you must install it on your Linux distro. The package is available in most Linux distros. You can easily use your Linux package manager to install it.
Install speedtest-cli on Debian / Ubuntu Linux
You can use the command below to install speedtest-cli on your Debian ad Ubuntu Linux distros:
sudo apt install speedtest-cli -y
Install speedtest-cli on Centos / RHEL / AlmaLinux / Rocky Linux
On the Centos and RHEL-based Linux distros, you can use the command below to install speedtest-cli:
# sudo yum install speedtest-cli -y #centos7-rhel7 # sudo dnf install speedtest-cli -y #centos8-rhel8-rhel9
Note: The speedtest-cli is available under the Epel repository on Centos and RHEL-based distros. Before installing speedtest-cli, you need to install Epel Repository:
# sudo yum install epel-release #sudo dnf install epel-release
Test Network Speed with speedtest-cli
At this point, you can run a simple speed test by using the following command on your Linux terminal:
Wait for the result. In your output, you will see your upload and download speeds.
Example Output Ping: 22.136 ms Download: 229.15 Mbit/s Upload: 164.32 Mbit/s
Also, you can get more information about your network by running the speedtest-cli command without any option:
This will show you information about your network during and after the test (such as IP address, test location, etc).
Example Output Retrieving speedtest.net configuration... Testing from M247 Ltd (your-ip-address)... Retrieving speedtest.net server list... Selecting best server based on ping... Hosted by ...: 20.47 ms Testing download speed................................................................................ Download: 196.73 Mbit/s Testing upload speed...................................................................................................... Upload: 120.75 Mbit/s
To get more options, you can use the command below:
Output usage: speedtest-cli [-h] [--no-download] [--no-upload] [--single] [--bytes] [--share] [--simple] [--csv] [--csv-delimiter CSV_DELIMITER] [--csv-header] [--json] [--list] [--server SERVER] [--exclude EXCLUDE] [--mini MINI] [--source SOURCE] [--timeout TIMEOUT] [--secure] [--no-pre-allocate] [--version] Command line interface for testing internet bandwidth using speedtest.net. -------------------------------------------------------------------------- https://github.com/sivel/speedtest-cli options: -h, --help show this help message and exit --no-download Do not perform download test --no-upload Do not perform upload test --single Only use a single connection instead of multiple. This simulates a typical file transfer. --bytes Display values in bytes instead of bits. Does not affect the image generated by --share, nor output from --json or --csv --share Generate and provide a URL to the speedtest.net share results image, not displayed with --csv --simple Suppress verbose output, only show basic information --csv Suppress verbose output, only show basic information in CSV format. Speeds listed in bit/s and not affected by --bytes --csv-delimiter CSV_DELIMITER Single character delimiter to use in CSV output. Default "," --csv-header Print CSV headers --json Suppress verbose output, only show basic information in JSON format. Speeds listed in bit/s and not affected by --bytes --list Display a list of speedtest.net servers sorted by distance --server SERVER Specify a server ID to test against. Can be supplied multiple times --exclude EXCLUDE Exclude a server from selection. Can be supplied multiple times --mini MINI URL of the Speedtest Mini server --source SOURCE Source IP address to bind to --timeout TIMEOUT HTTP timeout in seconds. Default 10 --secure Use HTTPS instead of HTTP when communicating with speedtest.net operated servers --no-pre-allocate Do not pre allocate upload data. Pre allocation is enabled by default to improve upload performance. To support systems with insufficient memory, use this option to avoid a MemoryError --version Show the version number and exit
Step 2 – Check Internet Speed From Linux Command Line with ping
Another way that you can test your network speed is to use the ping command. You can test your ping (speed between two computers) against your router or any server on the internet.
The ping command is installed by default on the Linus distros. You can easily check your server’s internet speed by using the command below:
Also, you can test your network speed against a website. For example:
That’s it you are done.
If you prefer to Check your Internet Speed from the command line on Linux, you can easily use the ping and speedtest-cli commands on the Linux terminal to test your network speed.
Hope you enjoy it. You may be interested in these articles too: