https://github.com/sivel/speedtest-cli
单文件版
# wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
# chmod +x speedtest-cli
# ./speedtest-cli
Retrieving speedtest.net configuration...
Testing from Hangzhou Alibaba Advertising Co.,Ltd. (123.57.244.62)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by shanxi CMCC 5G (Taiyuan) [359.85 km]: 22.227 ms
Testing download speed................................................................................
Download: 54.16 Mbit/s
Testing upload speed................................................................................................
Upload: 1.05 Mbit/s
# ./speedtest-cli --help
# vim ~/.bashrc
alias speedtest="/root/speedtest-cli --bytes"
# source ~/.bashrc
# speedtest
Retrieving speedtest.net configuration...
Testing from Hangzhou Alibaba Advertising Co.,Ltd. (123.57.244.62)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Henan CMCC 5G (Zhengzhou) [9.69 km]: 22.435 ms
Testing download speed................................................................................
Download: 9.61 Mbyte/s
Testing upload speed................................................................................................
Upload: 0.15 Mbyte/s
安装版
# git clone https://github.com/sivel/speedtest-cli.git
# cd speedtest-cli/
# python setup.py install
# speedtest --help