- SpeedTest-CLI: тестирование скорости соединения из командной строки Linux
- Предварительные действия
- Запуск скрипта speedtest-cli
- Установка утилиты Speedtest-cli
- HowTo: TEST Internet Speed via Linux Command Line
- Test Download/Upload Internet Speed in Linux
- Test Internet Speed From the Linux Command Line
- Share the Result Of Speed Test via Speedtest.net
- Get the List Of Available Speedtest.net Servers
- Measure the Network Speed to Specific Server
- Run an Internet Speed Test from the Linux Command Line
- Different Speed Test Packages
- Unofficial Speedtest-CLI Python Script
- Official Ookla Speedtest CLI
- The Speedtest-cli Python Script
- Installing the Speedtest-cli Python Script
- Install on Fedora using DNF
- Ubuntu or Debian using APT
- CentOS/Red Hat 7 / 8
- How to Use the Python Script to Run a Speed Test
- Speedtest-cli Python Script Options
- List Available Speed Test Servers
- Specify Specific Server to Test Against
- Only Test Upload or Download Speeds
- Format Output in JSON or CSV
- The Official Ookla Speedtest CLI
- Installing the Official Speedtest CLI
- Install Speedtest CLI on Ubuntu / Debian:
- Install Speedtest CLI on Fedora / Redhat / CentOS:
- How to Use the Official Speedtest CLI
- Official Speedtest CLI Options
- List Available Speed Test Servers
- Select Specific Server to Run Speed Test Against
- Change Unit Used for Speed Output
- Output Formatting Options
- Conclusion
- Speedtest from linux console
- Проверка скорости интернета Linux
- Проверка скорости интернета через терминал
- Установка SpeedTest-cli
- Проверка скорости интернет
- Выводы
SpeedTest-CLI: тестирование скорости соединения из командной строки Linux
Оригинал: SpeedTest-CLI: Run network speedtest on Linux CLI
Автор: SHUSAIN
Дата публикации: 19 января 2018 года
Перевод: А. Кривошей
Дата перевода: июль 2018 г.
Выполнение теста скорости сетевого подключения на серверах или на рабочих столах является одной из обычных задач, которые выполняются почти на регулярной основе. Большинство тестов скорости требуют запуска графического интерфейса, но как насчет серверов, на которых на самом деле нет установленного графического сервера? Для запуска теста скорости сети в консоли Linux мы можем использовать утилиту Speedtest-cli.
Speedtest-cli — это скрипт Python, который можно использовать для измерения скорости передачи данных. В этом руководстве мы узнаем, как проверить скорость соединения из командной строки с помощью speedtest-cli. Итак, давайте начнем с предварительных действий, которые необходимо выполнить для установки speedtest-cli.
Предварительные действия
1. Как уже упоминалось, Speedtest-cli — это скрипт python, и он требует, чтобы у нас была установлена версия Python от 2.4 до 3.5. Python предварительно установлен почти во всех дистрибутивах Linux, если нет, установите его с помощью следующих команд:
2. Во-вторых, нам нужно, чтобы на нашей машине был установлен pip. Как установить PIP на linux-машинах, можно узнать здесь .
Теперь у нас есть два способа, с помощью которых мы можем запускать speedtest в консоли Linux, то есть либо мы загружаем скрипт и запускаем его для измерения скорости соединения, либо мы можем установить утилиту speedtest-cli в систему и запускать ее как обычную команду.
Запуск скрипта speedtest-cli
Чтобы первый метод заработал, нам нужно только загрузить скрипт speedtest-cli. Загрузите скрипт, используя следующую команду:
Затем дайте ему права на исполнение:
Теперь все, что нам нужно сделать, выполнить скрипт, используя любую из приведенных ниже команд:
Установка утилиты Speedtest-cli
Чтобы установить speedtest-cli в нашу систему, мы будем использовать PIP. Выполните следующую команду для установки speedtest-cli:
Или мы также можем использовать репозиторий github для установки,
Эта команда установит утилиту speedtest-cli в системе. Теперь мы можем запускать ее как обычную программу. Выполните приведенную ниже команду, чтобы увидеть все параметры, которые можно использовать с speedtest-cli:
Источник
HowTo: TEST Internet Speed via Linux Command Line
If you need to troubleshoot an issue with slow Internet access on your Linux system, it would be a good idea to measure the current Internet speed.
In this article you’ll find how to test Internet speed from the Linux terminal, using speedtest_cli – a simple command-line client written in Python for measuring Internet bandwidth by using Speedtest.net infrastructure.
I’ll show how to simply check download/upload Internet speed to the geographically closest server, how to measure the network speed to specific server and how to share the results of speed test via Speedtest.net.
All these tasks can be performed using the Linux command line only.
Test Download/Upload Internet Speed in Linux
Use the following command to Test Internet Download and Upload Speed from the Linux Command Line:
Test Internet Speed From the Linux Command Line
If you are planing to measure Internet bandwidth often, you can install speedtest script on your system:
After installation, you will be able to test Internet speed from the terminal by simply running speedtest command, as follows:
Share the Result Of Speed Test via Speedtest.net
If you want to share the result of speed test, run speedtest command, as follows:
Get the List Of Available Speedtest.net Servers
Run the following command to get the list of all available Speedtest.net servers around the world:
Measure the Network Speed to Specific Server
You can manually specify server ID during testing, instead of using the geographically closest one.
Let’s test the link to “1746) Vodafone DE (Frankfurt, Germany) [1937.90 km]”:
Источник
Run an Internet Speed Test from the Linux Command Line
We have all used tools like speedtest.net to test upload and download speeds. Whether it was to test the WiFi in that coffee shop (I use my own tether, never unknown hot spots), preparing for a LAN party (do people still do that?), or just a step in troubleshooting, we have all been there. For one reason or another you simply think you are being cheated of bandwidth, so you want independent verification of your speeds. This typically means opening a browser and going to a website to test your connection. But what if you want to run a speed test on a remote server? In this article we will discuss running an internet speed test from the Linux command line, and skipping the browser.
There is something about the raw efficiency of the command line that I am really attracted to. As I discussed in the article “5 Command Line Tool to Break Your Dependence on the GUI“, I try my best to stay away from the browser. It usually creates an unnecessary distraction. The internet is designed to grab your attention like a laser pointer does to a cat. So let’s get started, and figure out one more way to stay away from the GUI.
Different Speed Test Packages
There are a few different tools you can use to run a speed test from the command line. To make things even more confusing the two most popular share the same exact name, but both use the speedtest.net service.
Unofficial Speedtest-CLI Python Script
The first one is an independently written Python script that is simple to install and use. It is available in the default repositories for some popular Linux distributions.
Pros:
- Easy to install
- Wide Availability
- Full list of servers
- Can specify upload test, download test, or both
Cons:
- Minimal output format options
- No verbose output option
Official Ookla Speedtest CLI
The second tool is built by Ookla, the people who bring you the speedtest.net website and service. Installing it requires you to add a repo for your package manager. But the maintainers offer simple instructions for installation.
Pros:
- Official release from Ookla
- More robust formatting options
- Output easier to read, better layout
- Verbose output available
- Has repo making it easy to get updates
Cons:
- Use limited to nearby servers
- Cannot specify download or upload only
The Speedtest-cli Python Script
This is an easy way to get started running a speed test on the Linux command line.
Installing the Speedtest-cli Python Script
Simply use your package manager to install the package.
Install on Fedora using DNF
Ubuntu or Debian using APT
CentOS/Red Hat 7 / 8
Unfortunately, CentOS does not offer the rpm in their repos. It can still be easily installed.
Change to /usr/bin directory to make command available to all users:
Fetch script from github:
Make script executable:
Or just copy and paste the whole thing below as a single line:
How to Use the Python Script to Run a Speed Test
The most basic usage is to simply run the command. It will automatically select the best server based on ping responses.
Speedtest-cli Python Script Options
There are several options available to change the default behavior. Here we will outline the most popular options.
List Available Speed Test Servers
You can use the –list option to find a list of available servers to run your test against. At the time of writing this list is pretty extensive with 8829 possible servers.
NOTE: The servers are sorted by distance, closest first.
Specify Specific Server to Test Against
Once you have found the server you want to test against, you can use the –server to select it. The server ID is the first column in the output of the list option above.
Only Test Upload or Download Speeds
The option is actually designed to exclude a test. But since there are only two options it is effectively the same as selecting only one. To run only the download test, you exclude the upload, and vice versa.
Format Output in JSON or CSV
You can specify the output format in JSON or CSV. You also have the opton to use CSV with a custom delimiter. This is handy if you are going to use the output in some other script or application.
Using CSV with a custom delimiter. The default delimiter is a comma, which is implied by the name CSV. Here we use the –csv-delimiter option to change the delimiter to a pipe character.
The Official Ookla Speedtest CLI
The official Speedtest CLI (Command Line Interface) from Ookla is a little more robust. It has all of the options of the python script and more. There are also several output formats not available with the unofficial python script.
Ookla’s speedtest is also a little easier on the eyes. It spreads the information out which makes it easier to read and displays a neat little progress bar. A URL you can use to share the results is also displayed by default.
Installing the Official Speedtest CLI
Install Speedtest CLI on Ubuntu / Debian:
The Speedtest CLI from Ookla is supported on Ubuntu (xenial & bionic) and Debian (jessie, stretch, buster).
Install Speedtest CLI on Fedora / Redhat / CentOS:
Fedora has moved on to DNF for package management, but is still compatible with YUM. These instructions were tested on Fedora 31, CentOS 7 and Red Hat 8.
How to Use the Official Speedtest CLI
Once installed you can simply call the utility by typing “speedtest” at the command line. This will give you all the default information that you would see on the web version of speedtest.net.
Official Speedtest CLI Options
The options available in the official release are more robust. Here we will outline the popular options and how to use them.
List Available Speed Test Servers
Using the -L (–servers) option will give you a list of servers available to run a test against. This option will only show you servers that are “nearby”. What exactly determines nearby is undefined. But for me it looks like they are staying in the tri-state area (PA, NJ, DE).
Optionally, you can use the -o (–host) option and specify the FQDN of the server instead of the ID. But oddly, I don’t see a way to get the FQDN of the servers on the list. I am guessing this option is available for using a custom server.
I haven’t found a way to list all servers. If you are looking to test against a server on the other side of the country, you will have to find it another way.
Select Specific Server to Run Speed Test Against
You can use the -s (–server-id) option to select a server to use from the list. You must supply the server ID with this option. The server ID is the number in the first column of the list output above.
Change Unit Used for Speed Output
The -u (–unit) option can display the speed output in many different formats.
Decimal prefix, bits per second: bps, kbps, Mbps, Gbps
Decimal prefix, bytes per second: B/s, kB/s, MB/s, GB/s
Binary prefix, bits per second: kibps, Mibps, Gibps
Binary prefix, bytes per second: kiB/s, MiB/s, GiB/s
Output Formatting Options
The Ookla Speedtest CLI offers decent options for output formats.
- Human Readable – Default
- CSV – Comma Separated Value
- TSV – Tab Separated Value
- JSON – JavaScript Object Notation
- JSONL – JSON Lines
- JSON-PRETTY – JSON Pretty Printed
Here is an example using json-pretty.
Conclusion
Running a speed test from the command line may not be something that is needed on a daily basis for most people. However, it may prove useful in some troubleshooting situations.
In this article we cover how to run a speed test from the command line using two similar tools. The unofficial python script and the official Ookla Speedtest CLI. We discussed installing, using and setting options for each one. This should be enough to get you started.
For more information on these tools, visit their respective home pages found in the resources section below.
Источник
Speedtest from linux console
Command line interface for testing internet bandwidth using speedtest.net
speedtest-cli works with Python 2.4-3.7
Just download (Like the way it used to be)
It is not a goal of this application to be a reliable latency reporting tool.
Latency reported by this tool should not be relied on as a value indicative of ICMP style latency. It is a relative value used for determining the lowest latency server for performing the actual speed test against.
There is the potential for this tool to report results inconsistent with Speedtest.net. There are several concepts to be aware of that factor into the potential inconsistency:
- Speedtest.net has migrated to using pure socket tests instead of HTTP based tests
- This application is written in Python
- Different versions of Python will execute certain parts of the code faster than others
- CPU and Memory capacity and speed will play a large part in inconsistency between Speedtest.net and even other machines on the same network
Issues relating to inconsistencies will be closed as wontfix and without additional reason or context.
Источник
Проверка скорости интернета Linux
Скорость подключения к интернету — это очень важный параметр работы сети. При подключении к интернету в офисе или дома может понадобиться проверить скорость интернета linux. Обычно, для этого достаточно открыть какой-либо сайт и скачать файл. Но это не единственный способ.
Проверка скорости интернета Linux может быть выполнена с помощью специального сервиса — speedtest.net. Вы можете открыть сайт проекта в браузере, программа определит ближайший к вам сервер, а затем покажет скорость доступа к этому серверу. Для работы сервиса используется флеш-плеер. Но не это тема нашей статьи. Сегодня мы рассмотрим как узнать скорость сети linux через терминал.
Проверка скорости интернета через терминал
Конечно, вы могли бы скачать файл с помощью wget и таким образом узнать скорость интернета. Но тогда на скорость загрузки будет влиять не только пропускная способность вашей сети, но и скорость отдачи сервера. Поэтому лучше использовать сервис speedtest, это, возможно, даже из командной строки.
speedtest-cli — это скрипт, написанный на Python, который позволяет измерить скорость интернета linux в двух направлениях. Вы можете проверять скорость сети на определенном расстоянии или для конкретных серверов, а также делиться своим результатом в интернете.
Установка SpeedTest-cli
Утилита может быть установлена двумя способами. Или из репозитория пакетов Python, либо прямо с Github, мы рассмотрим оба способа. Начнем с более сложного.
Сначала обновите систему до самой последней версии:
sudo apt update
Установите скрипт установки пакетов python:
sudo apt install python-pip
Затем установите саму программу speedtest-cli с помощью pip:
sudo pip install speedtest-cli
Второй способ еще проще, сначала скачайте файл программы с GitHub и дайте ему права на выполнение:
wget -O speedtest-cli https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py
$ chmod +x speedtest-cli
Вы можете скопировать скрипт в папку /bin или выполнять его прямо из этой папки.
Проверка скорости интернет
Чтобы проверить скорость интернет linux достаточно запустить скрипт без параметров:
Вы можете посмотреть результат проверки в байтах, а не в битах:
Если хотите поделиться результатом с друзьями, можно попросить программу создать изображение:
Для получения информации только о ping, скорости загрузки и отдачи:
Посмотреть список доступных серверов можно с помощью параметра —list:
Теперь вы можете определить скорость соединения с нужным сервером, для этого достаточно указать ид сервера:
speedtest-cli —server 5907
Чтобы вывести версию утилиты выполните:
А для просмотра всех возможных опций программы:
Выводы
Утилита speedtest-cli очень проста в использовании и в то же время может оказаться очень полезной. Во всяком случае теперь вы знаете как выполняется проверка скорости интернета linux. Если у вас остались вопросы, спрашивайте в комментариях!
Источник