Speed test from linux

How to Test Your Linux Internet Speed Using Speedtest CLI

We always need to check the speed of the Internet connection at home and office. What do we do about this? Go to websites like Speedtest.net and begin the test. It loads JavaScript in the web browser and then selects the best server based upon ping and outputs the result. It also uses a Flash player to produce graphical results.

What about a headless server, where isn’t any web-based browser and the main point is, most of the servers are headless. Another bottleneck of such web browser-based speed testing is that you can’t schedule the speed testing at regular intervals.

Here comes an application “Speedtest-cli” that removes such bottlenecks and lets you test the speed of Internet connection from the command line.

What is Speedtest-cli

The application is basically a script developed in the Python programming language. It measures Internet Bandwidth speed bidirectionally. It uses speedtest.net infrastructure to measure the speed. Speedtest-cli is able to list servers based upon physical distance, test against the specific servers, and gives you a URL to share the result of your internet speed test.

To install the latest speedtest-cli tool in Linux systems, you must have Python 2.4-3.4 or a higher version installed on the system.

Install speedtest-cli in Linux

There are three ways to install the speedtest-cli tool. The first method involves the use of python-pip package while the second method is to download the Python script, make it executable and run it and the third method is to use the package manager. Here I will cover all ways…

On this page

Let’s get started…

Install speedtest-cli Using Python PIP

First, you need to install the python-pip package, then afterward you can install the speedtest-cli tool using the pip command as shown below.

Install PIP in Debian/Ubuntu/Mint
Install PIP in CentOS/RHEL
Install PIP in Fedora
Install PIP in openSUSE
Install PIP in Arch Linux

Once pip has been installed, you can install the speedtest-cli tool.

To upgrade speedtest-cli, at a later stage, use.

Install speedtest-cli Using Python Script

First, download the python script from Github using the wget command or curl command and make the script file executable.

Next, move the executable to /usr/bin folder, so that you don’t need to type the full path every time.

Install speedtest-cli Using Package Manager

You can also install speedtest-cli using your default package manager as shown.

Testing Linux Internet Connection Speed with speedtest-cli

1. To test the Download and Upload speed of your internet connection, run the speedtest-cli command without any argument as shown below.

Читайте также:  Acer aspire v3 571g bluetooth driver windows 10

Check Linux Download and Upload Speed

2. To check the speed result in bytes in place of bits.

Check Linux Internet Speed in Bytes

3. Share your bandwidth speed with your friends or family. You are provided with a link that can be used to download an image.

Share Linux Internet Speed Test Results

The following picture is a sample speed test result generated using the above command.

View Linux Internet Speed Test Results

4. Don’t need any additional information other than Ping, Download, and Upload?

Test Linux Internet Speed

5. List the speedtest.net server-based upon physical distance. The distance in km is mentioned.

List Speedtest Servers

6. The last stage generated a huge list of servers sorted on the basis of distance. How to get desired output? Say I only want to see the speedtest.net server located in Mumbai (India).

List Nearest Speedtest Servers

7. Test connection speed against a specific server. Use Server Id generated in example 5 and example 6 in above.

Test Linux Internet Speed Against Server

8. To check the version number and help of speedtest-cli a tool.

Speedtest Version and Help

Note: Latency reported by the tool is not its goal and one should not rely on it. The relative latency values output is responsible for the server selected to be tested against. CPU and Memory capacity will influence the result to a certain extent.

Conclusion

The tool is a must for system administrators and developers. A simple script that runs without any issue. I must say that the application is wonderful, lightweight, and do what it promises. I disliked Speedtest.net for the reason it was using flash, but speedtest-cli gave me a reason to love them.

speedtest_cli is a third-party application and should not be used to automatically record the bandwidth speed. Speedtest.net is used by millions of users and it is a good idea to Set Your Own Speedtest Mini Server.

That’s all for now, till then stay tuned and connected to Tecmint. Don’t forget to give your valuable feedback in the comments below. Like and share us and help us get spread.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

We are thankful for your never ending support.

Источник

Speedtest® CLI

Internet connection measurement for developers

Speedtest CLI brings the trusted technology and global server network behind Speedtest to the command line. Built for software developers, system administrators and computer enthusiasts alike, Speedtest CLI is the first official Linux-native Speedtest application backed by Ookla®.

With Speedtest CLI, you can easily:

  • Measure internet connection performance metrics like download, upload, latency and packet loss natively without relying on a web browser
  • Test the internet connection of your Linux desktop, a remote server or even lower-powered devices such as the Raspberry Pi® with the Speedtest Server Network™
  • Set up automated scripts to collect connection performance data, including trends over time
  • Use Speedtest in your programs by wrapping it in the programming language of your choice
  • View test results via CSV, JSONL or JSON

Install Options

Download Speedtest CLI

Speedtest CLI is maintained by the Ookla team. For assistance, please direct all inquiries to support@ookla.com.

Читайте также:  Solwin пасьянс для windows 10

macOS

Installing via brew will ensure you are always running the most up-to-date version of Speedtest CLI. You should update brew as frequently as possible.

Windows

Available for x86_64 only.

Linux

Available for: i386, x86_64, arm32, arm32hf, and arm64.

FreeBSD

Available for x86_64 only.

Our mission at Ookla is to make the internet better and faster for everyone by providing data and insights on real-world internet performance and quality. With billions of tests and coverage scans worldwide, we meet you where you are with apps for the devices you use most.

Источник

Disk Speed Test (Read/Write): HDD, SSD Performance in Linux

From this article you’ll learn how to measure an input/output performance of a file system on such devices as HDD, SSD, USB Flash Drive etc.

I’ll show how to test the read/write speed of a disk from the Linux command line using dd command.

I’ll also show how to install and use hdparm utility for measuring read speed of a disk on Linux Mint, Ubuntu, Debian, CentOS, RHEL.

To get the accurate read/write speed, you should repeat the below tests several times (usually 3-5) and take the average result.

Cool Tip: How to choose SSD with the best quality/price relation! Read more →

dd: TEST Disk WRITE Speed

Run the following command to test the WRITE speed of a disk:

dd: TEST Disk READ Speed

To get the real speed, we have to clear cache.

Run the following command to find out the READ speed from buffer:

Clear the cache and accurately measure the real READ speed directly from the disk:

dd: TEST Read/Write Speed of an External Drive

Cool Tip: Have added a new drive to /etc/fstab ? No need to reboot! Mount it with one command! Read more →

To check the performance of some External HDD, SSD, USB Flash Drive or any other removable device or remote file-system, simply access the mount point and repeat the above commands.

Or you can replace tempfile with the path to your mount point e.g.:

Reminder: All the above commands use the temporary file tempfile . Don’t forget to delete it when you complete the tests.

hdparm: Test HDD, SSD, USB Flash Drive’s Performance

And it can also be used as a simple benchmarking tool that allows to quickly find out the READ speed of a disk.

hdparm is available from standard repositories on the most Linux distributions.

Install hdparm depending on your Linux distribution.

Cool Tip: Troubleshooting an issue with a hard drive performance? It will be a good idea also to test download/upload Internet speed. It can be easily done from the Linux command line! Read more →

On Linux Mint, Ubuntu, Debian:

On CentOS, RHEL:

Run hdparm as follows, to measure the READ speed of a storage drive device /dev/sda :

17 Replies to “Disk Speed Test (Read/Write): HDD, SSD Performance in Linux”

Anyone has hdparm version for Android?

“Reminder: All the above commands use the temporary file tempfile. Don’t forget to delete it when you complete the tests.”
I can not find any place where you instruct as to how to delete the tempfile. How is this done safely?

go to directory where you executed the command, in terminal:
““rm tempfile““
or in a gui select the file and delete it.

Читайте также:  Что такое установка windows gui

I must have done something wrong. I tested first with bs=4k and count=256k.
It finished quickly.
Afterwards I decided myself to alter the parameters like so: bs=1M and count=256k
I didn’t know exactly what I was doing. I left it running not having slightest hunch if it’s wrong to interrupt it via Ctrl-C. It run approximately 1000 seconds having written almost 100GB of all 150GB free on the SSD. Only then I’ve read the man pages searching for clues but still didn’t found. So I have a couple of questions if kindly allowed. That ‘k’ at the end of count I am not sure of it’s meaning or even if it makes sense. I have to also ask what would have happened if the command filled the whole free space? Would it have stopped by itself with message/error? Was it dangereous for an ssd doing this. The fact I performed it from sysresccd on ssd with Windows installed has any effect on outcome?
I mean the if = is it from the RAM memory? I specified an of= on the ssd after mounting it like /mnt/windows/some.output.file. Is the way I did it significant for the results?

> bs=4k and count=256k
k means what it always means: about 1,000, but in the case of computers (here), usually 1024. “bs” means block size, “count” means number of blocks. So this means write 4k x 256k bytes. 1k x 1k = 1 megabyte (about 1,000 x about 1,000 = about 1,000,000). How many megabytes? Since we already took care of the ‘k’s; 4x 256 = 1024 (aka about 1000, or 1k again.) What’s 1k x 1k x 1k? 1 gigabyte (about 1,000,000,000.) You wrote 1 gigabyte of zeros.

> bs=1M and count=256k

1M = (1k x 1k)
(1k x 1k) x 1k(the k from “count”) = 1 gigabyte
1 gigabyte x 256 = 256 gigabytes.

You were writing 256 gigabytes of zeros. Your drive is only 150 gigabytes in size. It won’t hurt your drive, it will just delete everything on your drive. When it fills your drive, it will stop.

The “if” is not from ram, it is a program (/dev/zero) in your system disguised as a file but whenever it is read is just endless zeros.

How to check sdb drive?
Should I use /dev/sdb instead of /dev/zero here:
sync; dd if=/dev/zero of=/media/user/MyUSB/tempfile bs=1M count=1024; sync
?

I think you missed the best software package for this kind of tests. It’s called fio:
https://github.com/axboe/fio/

It’s not accurate. The second sync does not influence the measurement (it’s being run after dd reports the results) and thus it’s influenced by caching. If you try the same test with 4096 or 8192 megs, you’ll have worse results (but closer to the reality).

One way to correct for this is measuring the whole process with the time command and then doing the division manually. E.g.:
# time (sync; dd if=/dev/zero of=tempfile bs=1M count=8192; sync)

You’ll see that dd will report a higher throughput, but you can then divide 8192 with whatever seconds time comes up with.

You need `conv=fdatasync` in your dd commands to include flush and sync time. Otherwise the results will be way too high, as others have mentioned.

/dev/sdb2:
Timing cached reads: 16830 MB in 1.99 seconds = 8454.99 MB/sec
Timing buffered disk reads: 434 MB in 3.01 seconds = 144.27 MB/sec

great post:) keep simple

Hello, after doing some tests with different “GB” my storage on NVMe was filled with 7% (56GB), can I delete that storage or stay there permanently?

Источник

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