How to run a speed test for your seedbox via command line (SSH)
We're all too eager to check the unbelievable speeds of our seedboxes once we get them, and one way to achieve this is by downloading a popular torrent from a large general tracker and seeing what types of speeds you hit. Well I wanted to find an alternative method to conduct a speedtest and there happens to be a way via SSH.
The best part about this method is that it will generate a speedtest.net link with a shareable .PNG image just like running a normal speed test off a browser.
Note: There are more straight forward methods if your seedbox supports VNC/remote access.
1) For Windows users you will need a program called PuTTY, if you don't already have it you can download it from here. For Mac users you will need to run a pre-installed application called Terminal.
2) Launch the required application and SSH into your seedbox by following your particular seedbox's instructions for inputting the required information (e.g. host name, port, username, password). This will be slightly different between OS.
Once you have logged in, you will be greeted with a welcome message to your shell with a list of commands.
Quote:
Hi, welcome to your shell :)
Please use this shell for simple tasks and if you want to use rtorrent via
command line. Note that you are not permitted to compile or run additional
programs not included with your shell already. Any actions that violate
our acceptable use policy will result in your account being terminated.
We have added a few shell commands for your convenience:
command - what it does
----------------------------------------------------------------------------
quota - Shows your used disk space
rtorrent-status - Shows you if rtorrent is running
start-rtorrent - Starts the rtorrent daemon
stop-rtorrent - Stops the rtorrent daemon
resume-rtorrent - Go to the running rtorrent screen. Note that when you
finish you will have to detach your screen with Ctrl-A-D
or rtorrent will not continue to run in the background!
start-deluged - Start the Deluge Daemon
stop-deluged - Stop the Deluge Daemon
start-delugeweb - Start the Deluge Web Interface
stop-delugeweb - Stop the Deluge Web Interface
start-irssi - Starts the irssi daemon
stop-irssi - Stops the irssi daemon
intro - Prints this info
3) Check that you have python 2.X.X installed.
For example, it will say 'Python 2.7.6' if you have it or 'command not found' if you don't.
If you don't have it installed, enter this command.
Code:
sudo apt-get install python
4) Now you will need to download and install the command line interface to run speedtest.net.
Code:
wget -O speedtest-cli https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
chmod +x speedtest-cli
5) Enter the below command to bring up the help menu.
.
Quote:
usage: speedtest-cli [-h] [--bytes] [--share] [--simple] [--list]
[--server SERVER] [--mini MINI] [--source SOURCE]
[--timeout TIMEOUT] [--version]
Command line interface for testing internet bandwidth using speedtest.net.
--------------------------------------------------------------------------
https://github.com/sivel/speedtest-cli
optional arguments:
-h, --help show this help message and exit
--bytes Display values in bytes instead of bits. Does not affect
the image generated by --share
--share Generate and provide a URL to the speedtest.net share
results image
--simple Suppress verbose output, only show basic information
--list Display a list of speedtest.net servers sorted by
distance
--server SERVER Specify a server ID to test against
--mini MINI URL of the Speedtest Mini server
--source SOURCE Source IP address to bind to
--timeout TIMEOUT HTTP timeout in seconds. Default 10
--version Show the version number and exit
6) Having a look at these commands we can now run our desired speed test depending on how many variables we want to control.
a. A basic speed test with the below command,
will generate the following.
Quote:
Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from i3d B.V. (***.***.**.***)...
Selecting best server based on latency...
Hosted by fdcservers.net (Amsterdam) [0.77 km]: 5.851 ms
Testing download speed........................................
Download: 1210.27 Mbit/s
Testing upload speed............................................. .....
Upload: 369.45 Mbit/s
b. You can choose to remove all unnecessary information from your results.
Code:
./speedtest-cli --simple
Quote:
Ping: 6.022 ms
Download: 1548.91 Mbit/s
Upload: 380.98 Mbit/s
c. You can also dictate which server to run your speed test by generating a list of all servers sorted by distance.
Code:
./speedtest-cli --list > list.txt
nano list.txt
On Windows I believe this generates a .txt file while on Mac this generates a report within Terminal. Mac users will need to press Ctrl + X to exit.
Quote:
951) Networking4all B.V. (Amsterdam, Netherlands) [0.77 km]
4358) KPN (Amsterdam, Netherlands) [0.77 km]
6458) arte worldwide (Amsterdam, Netherlands) [0.77 km]
3386) NFOrce Entertainment B.V. (Amsterdam, Netherlands) [0.77 km]
You can now use the 3 or 4 digit code to pinpoint which server to run the speed test from. The default speed test will choose a server with the lowest latency.
Code:
./speedtest-cli --server 3386
Quote:
Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from i3d B.V. (***.***.**.***)...
Hosted by NFOrce Entertainment B.V. (Amsterdam) [0.77 km]: 6.4 ms
Testing download speed........................................
Download: 2739.88 Mbit/s
Testing upload speed............................................. .....
Upload: 380.69 Mbit/s
d. You can now combine all the above options including the ability to share your results.
Code:
./speedtest-cli --simple --server 3386 --share
https://www.speedtest.net/result/4478613903.png
I must add that the results of this test were not entirely convincing as the upload and download speeds were quite inconsistent between tests. I'd suggest you'd run as many tests as possible to get a better indication of speeds. This may be a limitation with the software involved and I will continue looking for more consistent methods. I also seemed to have difficulties generating a shareable image when either the download or upload values were exceptionally high.
The above method was tested on Terminal with Mac and the procedure should be identical for Windows. Please report if this is not the case and I will find a solution.