https://www.speedtest.net/apps/cli
works good.
speedtest -f json -I eth0
Reply on news.ycombinator.com