In your VPS or Cloud VM, run following in console:
wget https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
chmod +x speedtest.py
./speedtest.py
Example output:-
[root@demo ~]# ./speedtest.py
Retrieving speedtest.net configuration...
Testing from ControlVM Sdn Bhd (103.xxx.xxx.xxx)...
Retrieving speedtest.net server list...
Retrieving information for the selected server...
Hosted by Singtel (Singapore) [309.88 km]: 17.037 ms
Testing download speed................................................................................
Download: 546.05 Mbit/s
Testing upload speed................................................................................................
Upload: 481.71 Mbit/s
Alternatively, you can install from default repo of your OS.
Simply run yum install speedtest-cli or apt install speedtest-cli.
After installed, run speedtest-cli