Home Open Source Tools How to Check Internet Speed in Linux Using Speedtest CLI

How to Check Internet Speed in Linux Using Speedtest CLI

Many times to check our Internet speed we used to use a speedtest website to measure our network speed. Instead of using the utility from the web now, you have the option to use it from the terminal using Speedtest CLI.

[ You might also like: How to Check CPU Information in Linux ]

Speedtest CLI is a command-line utility for system administrators, software developers, and computer users to measure their Internet download and upload speed, latency, and packet loss from the Linux terminal. This utility is written in Python and you need Python 2.4 and above to make it work.

How to Install Speedtest CLI in Linux

There are many ways to install Speedtest CLI in your Linux distribution. There are common ways that can be used irrespective of the distribution you are using or you can use your distribution package manager to install the package as shown.

Install Speedtest CLI in Debian/Ubuntu & Mint

$ curl -s https://install.speedtest.net/app/cli/install.deb.sh | sudo bash
$ sudo apt-get install speedtest

Install Speedtest CLI in Redhat/Fedora & CentOS

$ curl -s https://install.speedtest.net/app/cli/install.rpm.sh | sudo bash
$ sudo yum install speedtest

Install Speedtest CLI Using PIP in Linux

Alternatively, you can install the Speedtest CLI package using PIP or downloading a package from GitHub. To install the package via pip run the following command. Depending upon how you configured pip in your machine you have to either use pip or pip3.

$ pip install speedtest-cli
$ pip3 install speedtest-cli

Install Speedtest CLI from GitHub in Linux

To download and install the package from GitHub run the following command.

$ git clone https://github.com/sivel/speedtest-cli.git
$ cd speedtest-cli
$ python setup.py install

Once installed, you can verify if the installation is successful by running:

$ speedtest-cli --version

speedtest-cli 2.1.3
Python 3.8.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0]

How to Use Speedtest CLI in Linux Terminal

Try running --help to get a list of flags available to use along with the utility.

$ speedtest-cli --help
Speedtest CLI Help
Speedtest CLI Help

Check Linux Internet Speed

To measure your internet speed run the following command. From the below image you can see this command measures your internet upload and download speed.

$ speedtest-cli
Test Linux Internet Speed
Test Linux Internet Speed

Check Linux Internet Download and Upload Speed

You can choose to test only upload or download speed by adding the below flags.

$ speedtest-cli --no-download   [Do not perform download test]
$ speedtest-cli --no-upload     [Do not perform upload test]
Test Linux Download and Upload Speed
Test Linux Download and Upload Speed

If you look at the output it gives a lot of verbose which can be simply omitted using the --simple flag.

$ speedtest-cli --simple
Check Linux Internet Speed
Check Linux Internet Speed

You can also get output in JSON format by adding the --json flag.

$ speedtest-cli --json
Check Speedtest in JSON Format
Check Speedtest in JSON Format

Check List of Speed Net Servers

You can get the list of speed net servers by running the following command. The list will be sorted by distance.

$ speedtest-cli --list
$ speedtest-cli | wc -l   # Total server count 
List of Speed Net Servers
List of Speed Net Servers

That’s it for this article. This Speedtest CLI tool will come in handy when you want to measure your Linux server internet speed when writing any scripts.

Ravi Saive
I am an Experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies. Founder of TecMint.com, LinuxShellTips.com, and Fossmint.com. Over 150+ million people visited my websites.

Each tutorial at UbuntuMint is created by a team of experienced writers so that it meets our high-quality standards.

Was this article helpful? Please add a comment to show your appreciation and support.

Got something to say? Join the discussion.

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published or shared. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.