If you are using Debian or Ubuntu operating system, install the speedtest application with the following command.
sudo apt-get install curl
curl -s https://install.speedtest.net/app/cli/install.deb.sh | sudo bash
after installing run speedtest command