📜  speed test cli - Shell-Bash (1)

📅  最后修改于: 2023-12-03 14:47:31.716000             🧑  作者: Mango

speed test cli - Shell-Bash

Introduction

speed test cli is a command-line tool written in Shell-Bash that allows you to test your internet connection speed. It uses the popular speedtest.net service to test your download and upload speed, as well as your ping.

This tool is ideal for programmers and system administrators who need to quickly check the speed of their internet connection from the terminal.

Features
  • Test your download speed
  • Test your upload speed
  • Test your ping
  • Supports both IPv4 and IPv6 connections
  • Output results in JSON, CSV, or TSV formats
  • Can be easily automated with scripts
Installation

speed test cli can be installed on Linux, macOS, and Free BSD. You can install it using the following command:

curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | sudo tee /usr/local/bin/speedtest-cli > /dev/null && sudo chmod +x /usr/local/bin/speedtest-cli
Usage

To test your internet speed, simply enter the following command in your terminal:

speedtest-cli

This will start the speed test and display the results:

Retrieving speedtest.net configuration...
Testing from Example ISP (192.168.1.1)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by Example Hosting (City, Country) [50.00 km]: 180.33 ms
Testing download speed................................................................................
Download: 78.42 Mbit/s
Testing upload speed................................................................................................
Upload: 14.53 Mbit/s

You can also output the results in JSON, CSV, or TSV formats using the --json, --csv, or --tsv flags:

speedtest-cli --json
{
  "download": 78415804.08408119,
  "upload": 14525008.111986194,
  "ping": 180.338,
  "server": {
    "url": "http://speedtest.example.com/speedtest/upload.php",
    "lat": "00.0000",
    "lon": "00.0000",
    "name": "Example Hosting",
    "country": "Country",
    "cc": "CC",
    "sponsor": "Example Hosting",
    "id": "12345",
    "host": "speedtest.example.com:8080"
  },
  "timestamp": "2022-01-01T00:00:00.000000Z",
  "bytes_sent": 15728640,
  "bytes_received": 103809952,
  "share": null,
  "client": {
    "ip": "192.168.1.1",
    "lat": "00.0000",
    "lon": "00.0000",
    "isp": "Example ISP",
    "isprating": "3.7",
    "rating": "4",
    "ispdlavg": "0",
    "ispulavg": "0",
    "loggedin": "0",
    "country": "Country"
  }
}
Conclusion

speed test cli is a simple and useful tool for testing your internet speed from the terminal. Its ease of use and compatibility with different platforms makes it a valuable addition to any programmer's toolkit.