Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i test the net speed from the command-line on a linux server(no gui)? [closed]

I am looking for ways to test the net speed on a linux box with no GUI from the command line. I am not interested in tools like bmon/iftop/wget/curl especially from the upload side of things, for download it is pretty easy with wget on different targets and servers(places). But i am more interested in the upload side of things, which is the most important part of a server's bandwidth. I want to test the upload speed on different servers and places around the world just like you could do it by visiting speedtest.net using a browser with flash. If that tool can handle download speeds too that way then all the better then.

like image 968
Shinnok Avatar asked Nov 28 '10 16:11

Shinnok


1 Answers

I'm not aware of a way to do this without a cooperating remote server. If you upload data, it has to go somewhere... Sites like speedtest.net do exactly that (they have a data sink somewhere).

Provided you do have ssh access to a remote server with a download link somewhat faster than the upload link you want to test, you may achieve this rather simply with netcat :

On your remote server (let's assume IP 1.2.3.4) :

$ nc -kl 12345 > /dev/null

On the machine you want to test :

$ time nc 1.2.3.4 12345 < large-file
$ stat -c'%s' large-file

Divide the file size by the "real" time and you have an estimation of your speed.

Note that you only need to run nc once on the server, and it will accept any number of sequential tests. If you only want it to work once (for security reasons or whatever), omit the -k flag.

like image 107
Thomas Avatar answered Oct 05 '22 09:10

Thomas