# Ubuntu/Debian
sudo apt-get install curl
curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash
sudo apt-get install speedtest
# Fedora/Centos/Redhat
curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.rpm.sh | sudo bash
sudo yum install speedtest
# FreeBSD 13
sudo pkg add "https://install.speedtest.net/app/cli/ookla-speedtest-1.2.0-freebsd13-x86_64.pkg"
# Then run the command:
speedtest
brew tap teamookla/speedtestbrew update
# Example how to remove conflicting or old versions using brew
# brew uninstall
speedtest --forcebrew install speedtest --force
Install speedtest-cli Using Python Script
$ wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
$ chmod +x speedtest-cli
OR
$ curl -Lo speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
$ chmod +x speedtest-cli
Move the executable to /usr/bin folder, so that you don’t need to type the full path every time.
$ sudo mv speedtest-cli /usr/bin/
Install speedtest-cli Using Package Manager
------ On Ubuntu/Debian/Mint ------
$ curl -s https://install.speedtest.net/app/cli/install.deb.sh | sudo bash
$ sudo apt-get install speedtest
------ On RHEL/CentOS/Fedora ------
$ curl -s https://install.speedtest.net/app/cli/install.rpm.sh | sudo bash
$ sudo yum install speedtest
USEFUL COMMANDS
1. To test the Download and Upload speed of your internet connection, run the command without any argument as shown below.
$ speedtest-cli
2. To check the speed result in bytes in place of bits.
$ speedtest-cli --bytes
3. Share your bandwidth speed with your friends or family. You are provided with a link that can be used to download an image.
$ speedtest-cli --share
4. Don’t need any additional information other than Ping, Download, and Upload?
$ speedtest-cli --simple
5. List the speedtest.net server-based upon physical distance. The distance in km is mentioned.
$ speedtest-cli --list
6. The last stage generated a huge list of servers sorted on the basis of distance. How to get desired output? Say I only want to see the speedtest.net server located in Mumbai (India).
$ speedtest-cli --list | grep -i Mumbai
7. Test connection speed against a specific server. Use Server Id generated in example 5 and example 6 in above.
$ speedtest-cli --server 23647 ## Here server ID 23647 is used in the example.
8. To check the version number and help of speedtest-cli a tool.
$ speedtest-cli --version
$ speedtest-cli --help