test internet speed terminal linux

C++
#Install it
sudo apt install speedtest-cli
#To run net speed 
speedtest-cli
#result as follows:
Testing download speed................................................................................
Download: 9.54 Mbit/s
Testing upload speed......................................................................................................
Upload: 14.61 Mbit/ssudo apt install speedtest-clicurl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -

Source

Also in C++: