Speedtest CLI: Command-Line Guide For Network Testing

by Jhon Lennon 54 views

Hey there, tech enthusiasts! Ever wondered how to quickly check your internet speed without opening a browser? Well, the Speedtest CLI is your answer! It's a command-line tool from Speedtest.net that lets you test your internet speed directly from your terminal. In this guide, we'll dive deep into the Speedtest CLI, covering everything from installation to advanced commands. Let's get started!

Installation

Before we get to the commands, let's get the Speedtest CLI installed. The installation process varies slightly depending on your operating system. Here’s how to do it on different platforms:

Windows

  1. Download the CLI: Head over to the official Speedtest CLI download page and grab the Windows version.
  2. Extract the ZIP File: Once downloaded, extract the contents of the ZIP file to a location of your choice, such as C:\Speedtest.
  3. Add to Path (Optional but Recommended): To run the speedtest command from any directory, you'll want to add the installation directory to your system's PATH environment variable.
    • Search for "Edit the system environment variables" in the Start Menu.
    • Click "Environment Variables…"
    • Under "System variables," find the "Path" variable, select it, and click "Edit…"
    • Click "New" and add the path to your Speedtest CLI installation (e.g., C:\Speedtest).
    • Click "OK" on all windows to save the changes.

Now, open Command Prompt or PowerShell and type speedtest to see if it works. If it does, you're all set!

macOS

For macOS, you can use Homebrew, a popular package manager. If you don't have Homebrew installed, you can install it by running the following command in your terminal:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Once Homebrew is installed, use the following command to install Speedtest CLI:

brew install speedtest-cli

After the installation, simply type speedtest in your terminal to run the speed test.

Linux

On Linux, the installation process can vary depending on your distribution. Here’s how to do it on Debian/Ubuntu and Fedora/CentOS.

Debian/Ubuntu:

sudo apt-get update
sudo apt-get install speedtest-cli

Fedora/CentOS:

sudo yum install speedtest-cli

Alternatively, you can use the snap package manager:

sudo snap install speedtest-cli

After installation, you can run the speed test by typing speedtest in your terminal.

Basic Commands

Now that you have Speedtest CLI installed, let's look at some basic commands to get you started. These commands are simple but powerful, giving you a quick snapshot of your internet performance.

speedtest

This is the most basic command. Just type speedtest in your terminal and hit Enter. It will automatically find the nearest Speedtest server and run a test, displaying your download speed, upload speed, and ping.

The command speedtest is the foundation of using the Speedtest CLI, providing a straightforward way to assess your network's current performance. When executed, it automatically selects the nearest available test server based on your IP address and geographical location, ensuring the most accurate results possible. This process involves identifying the server with the lowest latency to your location, which helps minimize potential distortions in the test data. The output of the command includes three key metrics: download speed, upload speed, and ping latency. Download speed is measured in Mbps (megabits per second) and indicates how quickly data can be transferred from the server to your device. A higher download speed is generally better, as it allows for faster loading of web pages, streaming of videos, and downloading of files. Upload speed, also measured in Mbps, reflects how quickly data can be sent from your device to the server. This is particularly important for activities like video conferencing, uploading files to cloud storage, and sending emails with large attachments. Ping latency, measured in milliseconds (ms), represents the round-trip time for data to travel from your device to the server and back. Lower ping latency is preferable, as it results in a more responsive and lag-free online experience, especially in applications like online gaming and real-time communication. By providing these essential metrics, the speedtest command offers a comprehensive overview of your network's performance, enabling you to quickly identify any potential issues or bottlenecks that may be affecting your internet speed and overall online experience. For example, if you notice consistently low download speeds, it may indicate a problem with your internet service provider (ISP) or your home network configuration. Similarly, high ping latency could suggest network congestion or routing issues that need to be addressed.

speedtest --simple

If you want a more concise output, use the --simple option. This will give you a simplified version of the results, showing only the ping, download speed, and upload speed.

The speedtest --simple command provides a streamlined and minimalistic output, making it ideal for users who need a quick and easy-to-understand snapshot of their internet speed without the additional details. When you run this command, the Speedtest CLI performs a standard speed test and displays only the essential metrics: ping latency, download speed, and upload speed. The ping latency, measured in milliseconds (ms), indicates the responsiveness of your network connection, reflecting the time it takes for a small data packet to travel from your device to the test server and back. Lower ping values are desirable, as they translate to a more responsive and lag-free online experience, particularly important for real-time applications like online gaming, video conferencing, and interactive web applications. The download speed, measured in megabits per second (Mbps), represents the rate at which data can be transferred from the test server to your device. This metric is crucial for activities such as streaming videos, downloading files, and browsing websites. Higher download speeds allow for faster loading times and a smoother, more enjoyable online experience. Conversely, the upload speed, also measured in Mbps, indicates the rate at which data can be sent from your device to the test server. This is particularly relevant for tasks like uploading files to cloud storage, sending emails with large attachments, and participating in video conferences. A faster upload speed ensures that your data can be transmitted quickly and efficiently. By focusing solely on these three key metrics, the speedtest --simple command offers a clear and concise overview of your network's performance, allowing you to quickly assess your internet speed without being overwhelmed by extraneous information. This is especially useful when troubleshooting network issues or simply wanting to check your speed on the fly. The simplified output makes it easy to compare your results against your expected speeds or to monitor your network performance over time. Whether you are a casual user or a seasoned network administrator, the speedtest --simple command provides a valuable tool for quickly assessing your internet connection's performance.

Advanced Commands

Ready to take your Speedtest CLI skills to the next level? These advanced commands give you more control over the testing process.

speedtest --list

This command displays a list of available Speedtest servers. Each server is listed with its ID, name, and distance from your location. This is useful if you want to specify a particular server for testing.

The speedtest --list command is an incredibly useful tool for users who want to have greater control over their speed testing process. When executed, this command provides a comprehensive list of all available Speedtest servers, complete with detailed information about each one. This information includes the unique ID of the server, its name, the city and country where it is located, and the distance from your current geographical location. The primary benefit of using the speedtest --list command is that it allows you to select a specific server for your speed tests. This can be particularly advantageous in situations where you suspect that the automatically selected server may not be providing accurate or representative results. For example, if you are experiencing slow speeds when accessing a particular service or website, you can use the speedtest --list command to identify servers that are geographically closer to the location of that service. By testing your speed against these servers, you can gain a better understanding of whether the issue lies with your connection to that specific location or with your overall internet performance. Additionally, the speedtest --list command can be valuable for troubleshooting network issues. If you notice significant discrepancies in your speed test results when using different servers, it may indicate a problem with network routing or peering agreements between your internet service provider (ISP) and certain server locations. This information can be helpful when communicating with your ISP to report and resolve network issues. Furthermore, the ability to select specific servers allows you to conduct more consistent and repeatable speed tests. By consistently testing against the same server over time, you can track changes in your network performance and identify any potential degradation in service quality. This can be particularly useful for monitoring the impact of network upgrades or changes to your internet plan. Whether you are a casual user or a network administrator, the speedtest --list command provides a powerful tool for gaining deeper insights into your network performance and ensuring that your speed tests are accurate and reliable.

speedtest --server [server ID]

To specify a server, use the --server option followed by the server ID. For example, speedtest --server 1234 will run the test against the server with ID 1234.

The speedtest --server [server ID] command provides a crucial level of control for users who require precise and consistent speed testing. This command allows you to designate a specific Speedtest server to be used for your tests, bypassing the automatic server selection process. The [server ID] parameter is a numerical identifier that corresponds to a particular server in the Speedtest network. You can obtain a list of available server IDs by running the speedtest --list command, which displays all accessible servers along with their respective IDs. One of the primary benefits of using the speedtest --server [server ID] command is the ability to ensure consistency in your speed test results. By consistently testing against the same server, you can minimize the impact of variations in network conditions and server load, which can affect the accuracy of your measurements. This is particularly useful for monitoring your network performance over time or for comparing results across different devices or locations. Furthermore, this command is invaluable for troubleshooting network issues. If you suspect that you are experiencing problems connecting to a specific server or region, you can use the speedtest --server [server ID] command to test your connection to a server in that area. By comparing the results to those obtained from testing against other servers, you can identify whether the issue is isolated to that particular server or indicative of a broader network problem. The ability to select specific servers also allows you to tailor your speed tests to your specific needs. For example, if you frequently access content from a particular region, you may want to test your connection to a server in that region to ensure that you are getting optimal performance. Similarly, if you are using a VPN, you can use the speedtest --server [server ID] command to test your connection to a server located in the same region as your VPN server, verifying that your VPN is functioning correctly and that your traffic is being routed through the intended location. Whether you are a network administrator, a gamer, or simply a user who wants to ensure the best possible online experience, the speedtest --server [server ID] command provides a powerful tool for optimizing your network performance and gaining deeper insights into your internet connection.

speedtest --share

This command generates a shareable image of your test results. After running the test, it will provide a URL to an image that you can share on social media or with your ISP.

The speedtest --share command offers a convenient and user-friendly way to disseminate your speed test results, making it easy to share your findings with friends, colleagues, or even your internet service provider (ISP). When you execute this command, the Speedtest CLI performs a standard speed test and then generates a unique, shareable image of your results. This image is hosted on the Speedtest.net website and includes key metrics such as your download speed, upload speed, ping latency, and the name of the server you tested against. Along with the image, the command provides a URL that you can easily copy and paste into emails, social media posts, or messaging apps. One of the primary benefits of using the speedtest --share command is its simplicity. Rather than having to manually record your results and create your own visual representation, the command automates the entire process, saving you time and effort. The generated image is professionally designed and clearly presents your results, making it easy for others to understand your network performance. This is particularly useful when troubleshooting network issues with your ISP. By sharing your speed test results, you can provide them with concrete evidence of the problems you are experiencing, helping them to diagnose and resolve the issue more efficiently. The speedtest --share command is also a great way to compare your internet speed with others. Whether you're bragging about your lightning-fast connection or commiserating over slow speeds, sharing your results can spark interesting conversations and provide valuable insights into the performance of different ISPs and network infrastructures. Furthermore, the command can be used to track your network performance over time. By regularly running speed tests and sharing the results, you can create a visual record of your network's performance, identifying any trends or patterns that may indicate underlying issues. This can be particularly useful for monitoring the impact of network upgrades or changes to your internet plan. Whether you are a casual user or a network administrator, the speedtest --share command offers a convenient and effective way to share your speed test results and gain deeper insights into your network performance.

speedtest --bytes

By default, Speedtest CLI displays speeds in bits per second. If you prefer to see the results in bytes per second, use the --bytes option.

The speedtest --bytes command allows you to customize the units in which your speed test results are displayed, providing an alternative to the default bits per second (bps) format. By default, the Speedtest CLI presents your download and upload speeds in megabits per second (Mbps), which is a common unit for measuring internet bandwidth. However, some users may prefer to see their results in bytes per second (Bps), as this unit is more commonly used in other contexts, such as file transfer rates and storage capacity. The speedtest --bytes command simply instructs the Speedtest CLI to display your speeds in bytes per second instead of bits per second. This can be particularly useful if you are accustomed to thinking about data transfer rates in terms of bytes or if you need to compare your speed test results with other measurements that are expressed in bytes. For example, if you are downloading a file and want to verify that your download speed is consistent with your speed test results, you can use the speedtest --bytes command to see your speed in bytes per second and then compare it to the file's download rate. The conversion between bits and bytes is straightforward: 1 byte is equal to 8 bits. Therefore, a speed of 1 Mbps is equivalent to 125 KBps (kilobytes per second) or 0.125 MBps (megabytes per second). The speedtest --bytes command does not affect the actual speed test process or the underlying measurements. It simply changes the way the results are displayed. This means that you can use the command interchangeably with other Speedtest CLI options without affecting the accuracy or reliability of your tests. Whether you are a casual user or a network administrator, the speedtest --bytes command provides a simple and convenient way to customize the presentation of your speed test results and ensure that they are displayed in a format that is most useful to you.

Conclusion

The Speedtest CLI is a powerful tool for quickly and accurately testing your internet speed from the command line. Whether you're troubleshooting network issues or just curious about your connection speed, these commands will help you get the information you need. Happy testing, folks!