Linux текущая скорость сети

How to check Internet Speed via Terminal?

Instead of going to sites like speedtest.net, I want to check my current Internet speed from the terminal on Ubuntu. How can I do it?

The results I’m getting with speedtest-cli are vastly under what I get from speedtest.net speedtest-cli Download 18.27 Mbits/s Upload 3.43 Mbits/s speedtest.net Download 59.38 Mbits/s Upload 12.14 Mbits/s I can’t consider speedtest-cli to be in any way a valid test of network speed.

@user375058: The speedtest-cli uses the same servers (etc.) as SpeedTest.net. You should consider the speedtest-cli and www.speedtest.net to be equivalent, just with a different front-end. I would be surprised if you get significantly different results consistently if they both use the same server. If they aren’t using the same server, then you have no basis for comparison. Lastly, my results for both utilities vary by a factor of 2-4 from run to run. I suggest you test 2-4 servers, and perform 3–4 runs for each server and compare tools.

16 Answers 16

I recommend the speedtest-cli tool for this. I created a blog post (Measure Internet Connection Speed from the Linux Command Line) that goes into detail of downloading, installing and usage of it.

The short version is this: (no root required)

curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python - 
Retrieving speedtest.net configuration. Retrieving speedtest.net server list. Testing from Comcast Cable (x.x.x.x). Selecting best server based on ping. Hosted by FiberCloud, Inc (Seattle, WA) [12.03 km]: 44.028 ms Testing download speed. Download: 32.29 Mbit/s Testing upload speed. Upload: 5.18 Mbit/s 

Update in 2016:

speedtest-cli is in Ubuntu repositories now. For Ubuntu 16.04 (Xenial) and later use:

sudo apt install speedtest-cli speedtest-cli 

Update in 2018:

Using pip install —user speedtest-cli gets you a version that is probably newer than the one available from your distribution’s repositories.

Update in 2022:

sudo apt install speedtest-cli speedtest-cli --secure 

This doesnt seem to work properly. I have BT infinity 50bBit down and 20Mbit up. But the results show up as 0.53Mbit down and 0.2Mbit up. Huh? Incorrect decimal placing? using wget I get 4.27M/s (34Mbit) (some other server though)?

As it has already been stated here: Since speedtest-cli is a python application, it is much easier to install by doing: pip install speedtest-cli or: easy_install speedtest-cli Depending on how Python is installed on your system, you may need to be root to do the above.

Confirming that speedtest-cli is broken. Doesn’t show speeds above 1Mbps. Doesn’t transfer any info when claiming to do so.

This should really be the accepted answer. speedtest-cli is working fine for me; think @int_ua was either having compatibility problems or internet problems.

This should be the right answer. Speed test means download AND upload. First answer ONLY measures the download speed, which is NOT a full picture of your internet connection speed. Especially if you are hosting something on that machine!

wget --output-document=/dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip 
sourceforge.net/projects/tespeed/ 

For me on Ubuntu 14.10 with python 2.7.8 the command wget —output-document=/dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zip works much better than using speedtset-cli the later seems to freeze and ^C fails to interrupte the command. With wget I have no problems cutting the download shrot with ^C

Читайте также:  Перенаправить поток вывода linux

Note that speedtest.wdc01.softlayer.com is just one specific Speedtest server. There are thousands of them all over the world, and depending on where you are located, testing with this one may or may not give you correct results. Speedtest.net choses the server closest to you automatically, which should be more relevant. Ideally, you should use your browser’s Dev Tools to figure out the hostname/URL speedtest.net choses in your case and use that in the wget line above instead of speedtest.wdc01.softlayer.com.

If you can’t be bothered to install iperf , you could precede any command that shifts a known amount of data with the time command and do a sum.

iperf is simple and easy to use.

It requires a client and server.

 user@client$ iperf -c server.domain ------------------------------------------------------------ Client connecting to 192.168.1.1, TCP port 5001 TCP window size: 16.0 KByte (default) ------------------------------------------------------------ [ 3] local 192.168.1.3 port 52143 connected with 192.168.1.1 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-10.0 sec 113 MBytes 94.7 Mbits/sec 

Those of you who don’t have a remote server you can connect to, there are publicly available iperf servers: iperf.cc

speedtest is useless as most internet providers know their servers’ addresses and prioritize them. I get results with iperf that are a 10th of what speedtest gives me. And those are the effective speeds I reach.

@dargaud Make sure you don’t mix TCP speed with UDP speed. Most speed test tools measure UDP speed, but iperf measures TCP by default. Use iperf -u -c servername to measure UDP speed. The results of that will probably be very close to what speedtest gives you.

Well I use wget for it. That little tool tells me nicely what speed I have.

To use it just point to a file in internet that is relatively bigger so that you can get a better estimate of it.

typing: wget http://hostve.com/neobuntu/pics/Ubu1.avi would start to download the Ubu1.avi file and show at what speed it is downloading.

enter image description here

Of course there are several recommendations:

  1. Speed test yourself with good servers. In the case of my link the speed is less than 200KB so if you have a higher speed, the server will be the bottleneck for you, not your actual speed.
  2. The highest speed you will see is the maximum speed that your connection and the server’s connection can offer. If your connection is 512KB and the place where you are downloading is 400KB, your max connection will be 400KB because it is the max for the server you are downloading from.
  3. You need to do the test at least 5 times to have a reliable speed check or at least do it for a minute or two. This will help you have a more accurate check.
  4. You need to have at least 4 or 5 different testing sources to have a more accurate speed. Never test only from the same site as this can be affected by your distance to it, any problem in the server and the connections to it, etc. Always test from different servers.
Читайте также:  Linux mint cinnamon with kde

This is an alternative to wget . The downside of wget is the lack of parallel connections. To use aria2 we fist need to download it:

 sudo apt-get install aria2 

enter image description here

In the image, the -x 4 is how many parallel connections we wish to use. The CN parameter in the next line shows how many active parallel connections were permitted to download from that site. In this case CN is 4. But if we tried to have more connections we would get something like this:

enter image description here

We set 8 parallel connections but the site only allowed a maximum of 5 as shown by CN:5. This could be solved by the -j option which tells aria2c the maximum concurrent connections we want (Which by default is 5) but if the server has limited this, -j will not work.

wget is not (yet) able to do a segmented download, that is to download a single file using multiple (parallel) connections, so if your ISP is limiting the speed per 1 connection, you won’t get accurate results. it would be a more precise test to use some other tool, that can at least use segmented download (like aria2)

This is NOT a speedtest, this is a DOWNLOAD speed test only! Internet speed test means down&up load! Second answer, and all others mentioning speedtest-cli have the correct approach.

@EmilBorconi You are correct but in real life, we are not doing benchmarking Internet speeds here, this are just your average current speed tests of any home user without the need for sites like speedtest. A download speed (Which is enough for anyone trying to see if they are having a bottleneck) is a good enough test. A full down/up speed test would check what the full scope of your speed is based on your ISP. So yeah that would be the best solution, but for any fast test scenario, even a simple wget would do the trick since normally people worry more about download speed than upload.

@LuisAlvarado sorry if I sounded rude, just I think people should be able to fully understand what they are asking / and what is the accepted answer. Lot’s of newbies will look at forums and they will assume / pick / stop at the accepted answer, and they form a false image in their had. And yes download is more important then upload unless you are a facebook maniac who post selfies each 5 minutes, then start a fight with you ISP just because you tested the download which is good, but you have a crappy upload. Once again sorry if my tone was rude, did not want to insult.

Читайте также:  Install pip linux centos

I like wget better than curl for this because wget displays MB/s (very clear that is MBytes/s), whereas curl just displays k (not very obvious that it is KBytes/s).

Since speedtest-cli is a python application, it is much easier to install by doing:

easy_install speedtest-cli 

Depending on how Python is installed on your system, you may need to be root to do the above.

I’m regularly using something like this:

% wget -O /dev/null --progress=dot:mega http://cachefly.cachefly.net/10mb.test ; date --2020-01-06 03:31:05-- http://cachefly.cachefly.net/10mb.test Resolving cachefly.cachefly.net (cachefly.cachefly.net). 2607:7700::18:0:1:cdea:afaf, 205.234.175.175 Connecting to cachefly.cachefly.net (cachefly.cachefly.net)|2607:7700::18:0:1:cdea:afaf|:80. connected. HTTP request sent, awaiting response. 200 OK Length: 10485760 (10M) [application/octet-stream] Saving to: > 0K . . . . . . 30% 3.02M 2s 3072K . . . . . . 60% 3.97M 1s 6144K . . . . . . 90% 3.94M 0s 9216K . . 100% 3.99M=2.8s 2020-01-06 03:31:08 (3.62 MB/s) - > saved [10485760/10485760] Mon Jan 6 03:31:08 CST 2020 % 

You can change the 10mb part in /10mb.test to 1mb , 4mb , 5mb , 10mb , 50mb , 100mb , 200mb , 400mb , 2000mb , 4000mb , and possibly some other values.

You can also change the —progress=dot:mega part to —progress=dot:default , —progress=dot:binary , —progress=dot:mega and —progress=dot:giga ; this setting helps you see how fast the download is going, and preserve more than a single reading over the whole duration of the download, which is helpful for when you need to share the results with someone, or just save it for your own records as a sort of a graph.

Источник

How can I verify the speed of my NIC in ubuntu?

Is there a command that I can verify by its output the speed of my NIC and some information about its characteristics such as duplex full or half .

3 Answers 3

Suppose your NIC name eth0 :

You can verify the speed and some informations by three Commands :

First Command :

enter image description here

Second Command :

enter image description here

FD : full duplex , Logic that enables concurrent sending and receiving. This is usually desirable and enabled when your computer is connected to a switch.

HD : half duplex , his logic requires a card to only send or receive at a single point of time. When your machine is connected to a Hub, it auto-negotiates itself and uses half duplex to avoid collisions.

Third command :

ethtool eth0 ethtool - Display or change ethernet card settings 
sudo apt-get install ethtool 
Settings for eth0: Supported ports: [ TP ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supported pause frame use: No Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Advertised pause frame use: No Advertised auto-negotiation: Yes Speed: 1000Mb/s Duplex: Full Port: Twisted Pair PHYAD: 0 Transceiver: internal Auto-negotiation: on MDI-X: Unknown Supports Wake-on: d Wake-on: d Current message level: 0x00000007 (7) drv probe link Link detected: yes 

Источник

Оцените статью
Adblock
detector