The speedtest.net site is a very popular place to check internet speed but it requires that your operating system has a browser. If you want to check your internet speed using the command line especially if your system does not have a browser, you can do as follows:
Step 1: Configure installer repository and download speedtest CLI
For Debian or Ubuntu
curl -s https://install.speedtest.net/app/cli/install.deb.sh | sudo bash
apt-get -y install speedtest
For Fedora, RHEL or AlmaLinux
sudo dnf -y install python python3
wget -O /usr/bin/speedtest https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
chmod +x /usr/bin/speedtest
Step 2: Now check your internet connection with the following command in the terminal:
speedtest
You might be asked to accept a license agreement for the first time, so just press ‘y’ and enter to continue.
If the scan is completed you might see the following output in the screenshot:
If you notice at the end of the script output above, the speedtest CLI has generated a Result URL in which if you paste that URL in a browser you will see the following speedtest similar result like when you test it via a browser:
There are many more options that are available for speedtest CLI. In order to see them execute the following in the terminal:
speedtest --help