To test the internet connection speed from an SSH command line on a Linux or Unix system, you can use the wget
or curl
command to download a large file from a remote server and measure the download speed.
For example, to test the download speed using the wget
command, you can use the following command:
wget -O /dev/null <url>
This will download the file at the specified <url>
and discard the contents of the file using the /dev/null
output file. The wget
command will display the download speed and other statistics when the download is completed.
For example:
--2022-12-18 22:25:01-- http://mirror.centos.org/centos/8/isos/x86_64/CentOS-8.3.2011-x86_64-boot.iso Resolving mirror.centos.org (mirror.centos.org)... 216.87.222.98 Connecting to mirror.centos.org (mirror.centos.org)|216.87.222.98|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 2107889664 (2.0G) [application/octet-stream] Saving to: '/dev/null' /dev/null 100%[============================================================================================================>] 2.00G 17.4MB/s in 1m 41s 2022-12-18 22:26:43 (17.5 MB/s) - '/dev/null' saved [2107889664/2107889664]
You can also use the curl
command to test the download speed. For example:
curl -s -w '%{speed_download}\n' -o /dev/null <url>
This will download the file at the specified <url>
and discard the contents of the file using the /dev/null
output file. The -s
option disables the progress bar, the -w
option specifies a format string to be printed after the download is completed, and the %{speed_download}
format string displays the download speed in bytes per second.
For example:
17586.000
Keep in mind that the download speed may vary depending on the server, the network conditions, and other factors. You may want to repeat the test multiple times and take the average of the results to get a more accurate measurement.
You can also use other tools, such as speedtest-cli
or iperf3
, to test the internet connection speed more extensively or to measure other aspects of the network performance.