Check your internet speed from command line with speedtest_cli

I found this the other day and couldn’t resist.

You can test your internet speed from command line using the python script “speedtest_cli”.

Here’s how to get it:

1. You can install it with pip:

pip install speedtest-cli

or use pip from github:

pip install git+https://github.com/sivel/speedtest-cli.git

2. Clone the whole code from github and install it with python:

git clone https://github.com/sivel/speedtest-cli.git
python speedtest-cli/setup.py install

3. Or just download the script and execute it.

wget -O speedtest-cli https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py
chmod +x speedtest-cli

How to use it

From the command line:

$./speedtest_cli.py

Typical outout will be:

$ ./speedtest-cli 
Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from XXX (XXX.XXX.XXX.XXX)...
Selecting best server based on latency...
Hosted by XXX (XXX) [2.12 km]: 92.277 ms
Testing download speed........................................
Download: 2.73 Mbits/s
Testing upload speed..................................................
Upload: 0.88 Mbits/s

You can even share your results by getting an image of it:

$ ./speedtest-cli --share

Which will generate a png file you can share.

Make sure to check all the option by using:

$ ./speedtest-cli --help

Bandwidth control in Linux

I’ve experienced a really weird issue while I’m browsing the web and downloading a file.. it seems that the download takes all the bandwidth of my connection.. well.. after googling around I’ve found these solution for both, Ubuntu and Fedora..

Ubuntu

Create the next file

 /etc/apt/apt.conf.d/76download

With this content:

Acquire
{
Queue-mode "access";
http
{
Dl-Limit "65";
};
};

Fedora

Edit the yum.conf (sudo gedit /etc/yum.conf) and add these lines at the end of the file:

# 70% of your connection bandwidth
throttle=70%
bandwidth=64000

That’s it…
Hope to be helpful…