Categories
Device

How to test your internet speed from the command line

Whether you’re struggling with lagging internet speeds or curious to know how your internet provider stacks up, it’s impossible to know just how fast your internet speed is without using a precise test. Top-quality internet speed tests can clear up any confusion quickly and easily.

Check out the following internet speed tests to learn more about your upload and download speeds, as well as other exciting information about your internet connection.

SpeedOf.Me

How to test your internet speed from the command line

SpeedOf.Me is an HTML5-based speed test that’s lightweight and designed to replicate real-world browsing and downloading conditions — it does so by requesting a series of files of increasing sizes and recording the download speed. The test tracks real-time info on downloads, uploads, latency, and other info like your IP address, server location, and more. You also have a history section to easily compare your tests to chart changes and a share section to share on Facebook or Twitter.

Rather than selecting a location, the website calculates the quickest and most reliable server from 127 available servers. All files are downloaded and uploaded in sequence — rather than simultaneously — to imitate real internet browsing conditions. It’s not only the prettiest speed test around, but it also provides the best data and features for a single visit. The site does require you to accept cookies before beginning, but some of our other picks do not.

TestMy.net

How to test your internet speed from the command line

If you’re looking for a test that offers more data than the average speed test, TestMy.net runs a series of examinations and provides useful comparison data. You will have options for testing download, upload, combined, or just latency when you first begin. Choose what you are interested in, and the test will automatically run — then, it’ll provide you with detailed charts on exactly how you performed.

The test can also show how speeds compare to others in your city, the world average, the U.S. average, and so on. Results can be saved for future use as well. If these numbers are a little unfamiliar to you, there’s also plenty of documentation and easy-to-understand guides that can help you better identify what the problem is with your internet connection.

Speedtest.net

How to test your internet speed from the command line

Ookla’s bandwidth diagnostic software shows up on many other speed test sites listed here, but the most full-featured iteration of the test is on Speedtest.net, which is owned by Ookla. The tech used here is both intelligent and speedy. It picks a nearby server (out of a list of more than 1,000), runs a full test, and returns information on upload and download speed, latency, and packet loss.

You can fill out a survey after the test, answering questions about your ISP’s claimed speed and monthly connection costs. This survey allows Ookla to amass an impressive database of consumer connection information, viewed and broken down by region — in the U.S., there are significant internet speed variables on its NetIndex site.

Run Test at Speedtest.net

Internet Health Test

How to test your internet speed from the command line

Do you want a complete look at how your Internet speed performs when it’s pushed? The Internet Health Test takes longer than other web-based tests, but that’s because it’s comprehensive. The test runs your connection through a gauntlet of servers and infrastructure to see how it does in various situations.

Don’t worry so much about the average speed here — it’s probably lower than your other tests. Instead, look at the different configurations run to see how well your connection did in various server arrangements. If you want to dive in, you can compare this to how you usually use the internet to see your expected speeds based on your typical activity, but that could take some research.

Note that the website has clarified its privacy policy and reserves the right to keep all test data for publishing studies. If you want to learn more about the organization behind the test, you can visit the nonprofit Code for Science & Society.

Fast.com

How to test your internet speed from the command line

Fast.com is an online speed test from Netflix. The site uses a simple interface and launches a speed test automatically. When the test is over, the site will display your current speed in Mbps.

Of course, Netflix mainly intends this for people who want to test if their current speed can handle Netflix content, especially high-def and 4K (even on your PC) content, which may benefit more from higher download speeds. You don’t have to use the test to determine if you can stream content from Netflix without buffering. We recommend this test if you want a fast and reliable option and don’t need additional latency data information.

The test allows users to choose a variety of language options. To access this feature, choose the Show More Info option after the test to display these extra details.

Google Fiber Speedtest

How to test your internet speed from the command line

Google offers a free, quick, and accurate Fiber Speedtest for anyone looking to test browser speed. You don’t have to subscribe to Google’s Fiber service, either. Google is known for efficiency and simplicity so you can trust the Fiber Speedtest will perform.

The test only takes up to 15 seconds and is extremely accurate. You’ll receive information on upload speed, download, and ping data.

The Fiber Speedtest can also tell you what server you’re using, along with other information. You can also find out how your internet speed compares with Google Fiber’s speeds. Get accurate and quick results with Google’s free Fiber Speedtest.

Quickly check the speed of your internet connection without having to deal with all the bloat of a webpage.

How to test your internet speed from the command lineEver wanted to perform a quick internet speed test, but avoid a bloated website like speedtest.net? If the answer is ‘Yes’, here’s a quick way to measure your internet speed using the command line.

speedtest-cli is a python tool that allows you to test your internet speed, from the command line, using speedtest.net. This tool allows you to perform a quick speed test, view all available servers sorted by distance, specify a server that you want to use in order to check your internet speeds, perform only a download or upload test or generate a speedtest.net share result image URL.

You can use speedtest-cli on both Linux, macOS and Windows.

1. Install on Linux:

  • Arch/Manjaro sudo pacman -S speedtest-cli
  • Debiant/Ubuntu/Pop!_OS/Linux Mint/etc sudo apt install speedtest-cli
  • Fedora sudo dnf install speedtest-cli
  • openSUSE sudo zypper install speedtest-cli
  • Other distros: if speedtest-cli is not in the repositories, you can install it using PIP. More info here.

1.1 Install on macOS:

  • use Homebrew. Install with brew install speedtest-cli

1.2 Install on Windows

  • Slightly more complicated but not impossible. Make sure you have python and pip installed and added to your system path. After that it’s just a matter of installing speedtest-cli using pip. See the installation instruction linked in step 1.

2. Once speedtest-cli is installed, check out the options with speedtest-cli -h

How to test your internet speed from the command line

3. To check your internet speed simply type speedtest or speedtest –simple for speedtest-cli to output only the ping, download and upload speeds. For other options, see step 2.

How to test your internet speed from the command line

SUPPORT

FSM has no ads or affiliate links. Your support would simply pay for our servers, domain and maintanance. If there’s any leftover change, we’ll get some coffee and a slice of pizza.

Check your internet and network speeds with these three open source tools.

How to test your internet speed from the command line

Subscribe now

Get the highlights in your inbox every week.

Being able to validate your network connection speed puts you in control of your computer. Three open source tools that enable you to check your internet and network speeds at the command line are Speedtest, Fast, and iPerf.

Speedtest

Speedtest is an old favorite. It’s implemented in Python, packaged in Apt, and also available with pip. You can use it as a command-line tool or within a Python script.

Install it with:

Then run it with the command speedtest:

This gives you your download and upload Internet speeds. It’s fast and scriptable, so you can run it regularly and save the output to a file or database for a record of your network speed over time.

Fast is a service provided by Netflix. Its web interface is located at Fast.com, and it has a command-line interface available through npm:

Both the website and command-line utility provide the same basic interface: it’s a simple-as-possible speed test:

The command returns your Internet download speed. To get your upload speed, use the -u flag:

iPerf

iPerf is a great way to test your LAN speed (rather than your Internet speed, as the two previous tools do). Debian, Raspbian, and Ubuntu users can install it with apt:

It’s also available for Mac and Windows.

Once it’s installed, you need two machines on the same network to use it (both must have iPerf installed). Designate one as the server.

Obtain the IP address of the server machine:

Your local IP address (assuming an IPv4 local network) starts with either 192.168 or 10. Take note of the IP address so you can use it on the other machine (the one designated as the client).

Start iperf on the server:

This waits for incoming connections from clients. Designate another machine as a client and run this command, substituting the IP address of your server machine for the sample one here:

iperf.png

It only takes a few seconds to do a test, and it returns the transfer size and calculated bandwidth. I ran a few tests from my PC and my laptop, using my home server as the server machine. I recently put in Cat6 Ethernet around my house, so I get up to 1Gbps speeds from my wired connections but much lower speeds on WiFi connections.

iperf2.png

How to test your internet speed from the command line

­You may notice where it recorded 16Gbps. That was me using the server to test itself, so it’s just testing how fast it can write to its own disk. The server has hard disk drives, which are only 16Gbps, but my desktop PC gets 46Gbps, and my (newer) laptop gets over 60Gbps, as they have solid-state drives.

iperf3.png

How to test your internet speed from the command line

Wrapping up

Knowing the speed of your network is a rather straightforward task with these tools. If you prefer to script or run these from the command line for the fun of it, any of the above projects will get you there. If you’re after specific point-to-point metrics, iPerf is your go-to.

What other tools do you use to measure the network at home? Share in the comments.

This article was originally published on Ben Nuttall’s Tooling blog and is used here with permission.

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?

How to test your internet speed from the command line

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)

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 2016:

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

How to test your internet speed from the command line

try this on command line

got it from above link

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.

How to test your internet speed from the command line

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.

How to test your internet speed from the command line

Of course there are several recommendations:

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.

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.

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.

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.

ARIA2

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:

To use it is simple:

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:

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.

When you are experiencing slow Internet access, you may want to test the Internet speed of your upstream ISP (often called last mile in the residential broadband networks) as part of troubleshooting. For that matter, Speedtest.net is probably the most widely used broadband speed testing website.

Underneath it, Speedtest.net loads JavaScript code in your web browser, which then automatically detects the closest Speedtest.net server from you, and measures download/upload speed by sending HTTP GET and POST requests to the server.

However, if you are trying to check Internet speed from a remote headless server, VPS or an otherwise desktop-less system, Speedtest.net’s Flash-based user-friendly interface would be no good. For those of you, there is a command-line interface (CLI) version of Speedtest.net, known as speedtest-cli. Here I will demonstrate how to use speedtest-cli to check Internet speed from the command line in Linux.

Install speedtest-cli on Linux

speedtest-cli is a simple CLI client written in Python for measuring bidirectional Internet bandwidth by using Speedtest.net infrastructure. It works with Python 2.4-3.4. Installing the latest speedtest-cli is nothing more than downloading the Python script.

Test Internet Connection Speed with speedtest-cli

It is straightforward to check your Internet speed with speedtest-cli . Running speedtest-cli command without any argument gets its job done.

This will automatically discover the closest Speedtest.net server (in terms of geographic distance), and report download and upload speed measured from the server.

How to test your internet speed from the command line

If you want to share the speed test result, you can use –share option, which will allow you to share speed test result with others in an image format via Speedtest.net.

How to test your internet speed from the command line

The following is a sample image automatically generated and uploaded to Speedtest.net by speedtest-cli .

How to test your internet speed from the command line

If you want to get a list of available Speedtest.net servers around the world, use –list option. It will display a sorted list of Speedtest.net servers (geographically closest ones first).

How to test your internet speed from the command line

In the server list shown above, each Speedtest.net server shows an associated server ID in front. You can manually specify server ID during testing, instead of using the geographically closest server. For example, if I want to use a sever in Washington DC, I specify a corresponding server ID (e.g., 935 ).

How to test your internet speed from the command line

NOTE: Don’t run any aggressive cron job! speedtest-cli is an unofficial third-party tool which is meant for residential users who want to check their broadband speed. You are not supposed to run any aggressive script with it. If you want to run automated bandwidth monitoring with speedtest-cli , you should set up your own Speedtest.net server, and run any automated test against it, instead of bombarding the Speedtest.net’s infrastructure which is shared with many others!

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal (Credit Card) or Bitcoin ( 1M161JGAkz3oaHNvTiPFjNYkeABox8rb4g ).

How to test your internet speed from the command line

Looking for a quick way to test your network speed? Well, you can always use a service like speedtest. Their results are accurate.

However, most advanced users prefer Ping command.

Why use ping? Well, it’s quick, platform independent, works even on a slow internet connection, and it can reveal some useful information if you know how to use it right.

What is ping command?

Ping (stands for Packet Internet groper) is a popular command line tool to check network related issue. Every OS has this inbuilt. And basically, it tells you how long does it take for a “data packet” to travel from your computer to a server and back to your computer. More time it takes, slower is your connection.

How does it work?

Think of it like a sonar. When you ping any server, you send the echo request ( ICMP ) to the target. And based on the time it took and the amount of the data that came back, you can test the reliability and speed of your connection.

Here is how you use Ping

1. Open command prompt.

If you are new to command prompt then first check out my post on different ways to open a command prompt. To open the terminal on mac type in the terminal in the spotlight, while Linux user can use the shortcut ctrl + alt+ T.

2. Once you see the cmd or terminal window, try the following command.

a. ping localhost

This will display your computer’s name and whether your system is able to receive and send information. You will notice the time it took for sending and receiving data packets is less than 1ms. This is because we are communicating to the same device.

This is rarely useful but something you should know.

b. ping google.com

This one extremely useful and usually used. If this command fails i.e. there is no response from the server. Then it means either the website is down or your internet.

Now, why ping google? Well, you can ping other websites as well, but since it’s extremely rare that Google’s servers are down or slow, pinging them is the preferred way to test internet connectivity.

Detail Analysis

174.194.36.32 – IP-address of Google.com (ping is also helpful to quickly find IP address of any website)

Lost 0% – It means the ping was successful and your internet is up. No packet was lost.

Avg time = 109 mili sec– if the avg time is less than 100, the connection is Ok and over 1000 is very slow. Though, this is a bit of generalization. It can give you a good idea but it’s defiantly not a holy grail.

Destination unreachable – It probably means that there is no route b/w your computer and destination website. Problem with your network device or internet is down from your ISP

Request timed out – Means no response was received for the given packet. Possibly a slow internet connection.

For more ping option type ping and hit enter

Ping option

If you want to ping the target continuously use the time (-t) parameter. To escape the loop use ctrl +c for both Mac and Windows.

Example ping google.com –t

If you want to send more or less than 4 requests, use -n followed by no of the count.

Example ping google.com –n 10

Windows sent four packets by default while MAC sent unlimited packets. To stop them in between use CTRL +C. Very useful.

If you want to send a packet data other than 32 bytes (default) use –l followed by numbers of bytes.

Example ping google.com –l 64

It not necessary that every host reply to your ping request. Sometimes pinging website like MSN and Microsoft return an error. Even though your internet connection is good.

Update 1

Apparently, I was having some problem with my WiFi router and ‘ping command’ was helpful. How? Well, it can tell you if the internet is down from your ISP or due to malfunctioning of your router. For instance

#1 If the internet is down from your ISP, then you will able to ping your router but to any website.

#2 If there is a problem with your router, then you will neither be able to ping any website or your router.

Update 2

You can quickly check your internet connectivity on your Android using PingTool. This app not only lets you ping a website but also do a port scan, whois look and has WiFi scanner. Much better than the speedtest Android app.

If you use the ping command a lot on Windows. Then instead of running it through cmd, use the run box instead of by typing cmd /c ping google.com. Here /c will close the cmd once you are done, but if you want to keep it open, use /o parameter.

Now, the advantage of launching it from the run box is, that it’s much quicker. Also, run box remembers history, so next time you want to run the command, press Win+R to open the run box, use the up/down to bring the ping command and then hit enter.

How to test your internet speed from the command line

All major operating systems allow you to test your Internet speed from the command line. In fact, it’s one of the quickest ways to do it. Yes, it’s also possible to use a web browser instead, but using speedtest-cli is a nifty command that’s worth knowing.

Furthermore, it also lets you test the Internet speed on a remote server and command line enthusiasts will surely love it!

It’s exceptionally easy to install speedtest-cli on Ubuntu. This method also works on other Debian-based distros. Simply run the command below:

The command might not be exactly the same on all Linux distros so it’s a good idea to search for the package named speedtest-cli in your distro’s package manager first.

Install speedtest-cli on Windows

How to test your internet speed from the command line

To install speedtest-cli on Windows, you will also need Python installed. However, once you have Python up and running on your system, you just need to run the command below if you want to install speedtest-cli:

From then on, you’ll be able to use speedtest-cli on your Windows PC. It’s worth mentioning that pip can also be used to install speedtest-cli on Mac and Linux but on these platforms using the system-wide package manager is a much more comfortable solution.

Install speedtest-cli on Mac OS

To install speedtest-cli on a Mac, the most convenient method is using Homebrew. Homebrew is a free and open-source package manager and it’s a must-have for those who often use the command line.

You can easily install Homebrew following the instructions provided on the official website. With Homebrew up and running, use this command to install speedtest-cli:

As you can see, the package name has an underscore (and you should use the command exactly as is) so it’s a bit different compared to the Linux package manager.

How to test your internet speed from the command line

In this quick post, I will be sharing a simple trick to test your internet speed through the command line. I know you can test your internet speed through a web browser, but there might be a few reasons for which you would prefer the command line tool instead. Maybe you’re remotely connected to a server via ssh , and want to test speeds on that machine. Maybe you’re already used to using commands to troubleshoot your network, and want to add a speedtest to your toolkit. Or, maybe you just think the command line is cool.

What e ver be the reason, testing your internet speed through the command line is much faster and easier. All you need to do is to install a package called speedtest-cli.

On Ubuntu(or any other Debian based distro), run:

For other Linux distros, you must change the apt with the respective package managers:

  • dnf for Fedora
  • pacman for Arch
  • yum for CentOS
  • zypper for openSUSE

Installing speedtest-cli on Windows is slightly more complicated. This is because first, you need to download and install Python. Then you need to ensure that both python and pip are added to the system PATH. But if you already have them installed, no worries! Just open the command prompt and run:

The simplest way to install speedtest-cli on a Mac is using Homebrew, the open-source package manager for Mac. Check out this guide to installing Homebrew if you don’t have it set up (if you use the command line a lot, you should absolutely install Homebrew).

Once Homebrew is set up, you can install speedtest-cli with a simple command:

Note the underscore in the package name: for some reason, the name is different in Homebrew than the Linux package manager.

Testing your internet speed using the command line is the same on all platforms. All you need to do is to type speedtest and hit the Enter key.

How to test your internet speed from the command line

I hope you found this post helpful and, if you liked it, do consider sharing it with others.

In order to test our broadband speed, we generally visit online speed testing sites like Speedtest.net or Fast.com, however there are many a times we may want to test the speed of the internet from the command line (terminal).

Whether you are a power user who normally uses command line over the GUI, or simply want to monitor your website speed without visiting an online site filled with ads, then there are couple of ways you can check your internet speed from the terminal on your OS. These commands will work on all operating systems including Windows, Mac and Linux.

How to test your internet speed from the command line

Speed test from command line

Install Pre-requisites

In order to test the net speed from command line, we will have to install a few programs. These programs require NodeJS which is available for all operating systems.

Head over to the NodeJS downloads page and grab the latest version suitable for your Operating System. You may already have NodeJS installed on your system. To check whether NodeJS is installed or not, run the command ‘node -v’ in terminal (or cmd).

Once you have NodeJS installed, you will be able to install publicly available npm modules. These modules are generally open source programs or libraries which serve different purposes. For example, we will make use of two node modules speed-test and fast-cli below to check internet speed. Both the programs are free, open source and developed by Sindre Sorhus.

Internet speed via speed-test CLI

Using the terminal, install speed-test module with the following command:

It will take a while for the module to get installed. Once it finishes installing, you will be able to run the command ‘speed-test’ from the command line. Running the command ‘speed-test’ will perform a speed test via your terminal and present a textual result as shown below:

The program tests your internet connection speed and ping using speedtest.net and displays the result in the terminal itself.

If you want a more detailed result, you can run the command ‘speed-test -v’ and it will give a verbose output which includes the server location and distance. You can refer to the documentation of this open source program on GitHub.

Internet speed via fast-cli

Alternatively, you can install and use fast-cli if you want to test your internet speed using fast.com.

Using the terminal, install fast-cli module with the following command:

Once it finishes installing, you will be able to run the command ‘fast-cli’ from you terminal and will get internet speed result as show below:

You can refer to the documentation of this open source program on GitHub.

Internet speed Comparison and Fixing Slow Internet

Command line utilities shown above are helpful in performing internet speed checks and for doing comparison of internet speed. If you are facing slow internet speed then you can use these command line tools to check your internet speed without the need of opening a browser and visiting any site.

Don’t forget to see our guide on how to use Google DNS to boost your internet browsing experience.