- 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
- Speedtest ��� linux �������
- Проверка скорости интернета Linux
- Проверка скорости интернета через терминал
- Установка SpeedTest-cli
- Проверка скорости интернет
- Выводы
- linux-notes.org
- Установка speedtest-cli для проверки скорости интернета в Unix/Linux
- -=1=- Установка speedtest-cli используя pythin-pip
- -=2=- Установка speedtest-cli используя Python скрипт
- -=3=- Установка speedtest-cli используя пакетный менеджер.
- -=4=- Установка speedtest-cli используя Github
- Использование speedtest-cli для проверки скорости интернета в Unix/Linux
- 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
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]”:
Источник
Speedtest ��� linux �������
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. Если у вас остались вопросы, спрашивайте в комментариях!
Источник
linux-notes.org
Утилита speedtest-cli — это скрипт, который написан на Python. Он измеряет скорость интернет-трафика в двух направлениях (аплоад и даунлоад) используя инфраструктуру speedtest.net для измерения скорости. Для данной программы необходимо установить Python 2.4-3.4 или выше.
Установка speedtest-cli для проверки скорости интернета в Unix/Linux
Есть несколько способов установить speedtest-cli:
- Первый способ — предполагает использование пакета python-pip.
- Второй способ — загрузить сценарий Python, сделать его исполняемым и запустить.
- Третий способ — использовать пакетный менеджер.
- Четвертый способ — скачать speedtest-cli используя Github.
Все команды я буду выполнять от суперпользователя, по этому — я залогинюсь под ним:
Вводим пароль от пользователя root и получаем его права.
-=1=- Установка speedtest-cli используя pythin-pip
И так, для начала выполняем установку python-pip, если не знаете как это сделать — вот статья:
И, выполняем установку speedtest-cli пакета:
Для обновления speedtest-cli, используйте:
-=2=- Установка speedtest-cli используя Python скрипт
Сначала загрузите скрипт python из github с помощью команды wget, распакуйте загруженный файл (master.zip):
После извлечения архива, перейдите в speedtest-cli-master папку и сделайте исполняемый файл:
Затем переместите исполняемый файл в /usr/bin директорию:
Вот еще один вариант:
-=3=- Установка speedtest-cli используя пакетный менеджер.
Если вы используйте Debian/Ubuntu ОС, выполните:
Если вы используйте CentOS/Fedora/RHEL ОС, выполните:
Если вы используйте Mac OS X, выполните:
Для начала, устанавливаем HomeBrew:
И выполняем установку:
-=4=- Установка speedtest-cli используя Github
И выполняем установку:
Или можно запустить следующую команду:
Использование speedtest-cli для проверки скорости интернета в Unix/Linux
В зависимости каким методом установки вы воспользовались, будет зависеть запуск speedtest-cli утилиты:
1. Чтобы проверить скорость загрузки и выгрузки своего интернет-соединения, запустите команду speedtest-cli без каких-либо аргументов, как показано ниже:
2. Для вывода информации в байтах (вместо битов), используйте:
3. Поделитесь своей пропускной способностью с друзьями или семьей. Вам предоставляется ссылка по завершению проверки:
Конечно, вы можете комбинировать оба варианта:
4. Вам не нужна дополнительная информация (кроме Ping, Download и upload), то для этого используйте:
5. Посмотреть сервера которые использует speedtest.net на основе физического расстояния ( км ):
6. На последнем этапе сформирован огромный список серверов, отсортированных по расстоянию. Как получить желаемый результат? Скажем, я хочу видеть только сервер speedtest.net, расположенный в Мумбаи (Индия):
7. Проверьте скорость подключения к определенному серверу. Используйте идентификатор сервера, сгенерированный в примере 5 и в примере 6:
Как указать идентификатор сервера для тестирования?
Во-первых, возьмите список серверов, введите:
Чтобы просмотреть идентификатор сервера, введите:
Чтобы выполнить поиск идентификатора сервера, введите:
Так же, можно показать только ID сервера(ов):
Далее используйте идентификатор сервера 6088:
8. Создание лога с помощью speedtest-cli
Speedtest-cli можно запустить как cronjob, чтобы получить лог-файл с тестом скорости интернет-соединения. Откройте crontab с помощью следующей команды:
И добавьте эту строку (я предполагаю, что speedtest_cli.py установлен в /usr/local/bin) в crontab:
Сохраните изменения и выйдите из редактора crontab. Это проведет тест скорости в 0:30 каждый день и добавит результат в файл /tmp/speedlog.txt.
9. Чтобы проверить версию утилиты, используйте:
10. Для дополнительной информации ( помощи), используйте:
На этом у меня все, статья «Установка speedtest-cli для проверки скорости интернета в Unix/Linux» завершена.
Источник
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.
Источник