How to Use speedtest-cli
speedtest-cli is a command-line tool that allows you to measure your internet connection speed by testing download and upload speeds against a server. Here’s a concise guide on how to use it effectively.
Installation
If speedtest-cli is not already installed, you can install it using pip (Python's package manager). Run the following command:
sudo apt install speedtest-cli
Basic Usage
Once installed, you can run speedtest-cli simply by typing:
speedtest-cli
This command will automatically:
- Find the Best Server: It selects the best server based on your location and current network conditions.
- Test Download Speed: Measures how fast data can be downloaded from the server.
- Test Upload Speed: Measures how fast data can be uploaded to the server.
Example Output
When you run the command, you will see output similar to this:
Retrieving speedtest.net configuration...
Testing from [Your Location] ...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by [Server Name] [x.xx ms]: ...
Testing download speed...
Download: 95.32 Mbit/s
Testing upload speed...
Upload: 88.14 Mbit/s
Additional Options
speedtest-cli offers several options to customize your tests:
-
List Servers: To see a list of available servers, use:
speedtest-cli --list -
Specify a Server: If you want to test against a specific server, you can use the
--serveroption followed by the server ID:speedtest-cli --server <server_id> -
Share Results: To generate a shareable link with your results, use:
speedtest-cli --shareThis will provide a URL to an image of your speed test results.
-
JSON Output: For scripting or logging purposes, you can get the results in JSON format:
speedtest-cli --json
Conclusion
Using speedtest-cli is straightforward and provides valuable insights into your internet connection's performance. Always ensure you have an active internet connection before running the tests to get accurate results.
Further Learning
To deepen your understanding of network performance testing, consider exploring:
- LabEx Labs: Look for labs that focus on network diagnostics and performance testing.
- Official Documentation: The speedtest-cli GitHub page provides comprehensive details on all available options and usage.
If you have any more questions or need further clarification, feel free to ask! Your feedback is always appreciated to help improve these explanations.
