Linux / Unix: Test Internet Connection Speed From SSH Command
I have recently rented a dedicated server for my hobby projects and learning CentOS Linux server. I was informed that I am connected to the 100M/s port. How do I test my Internet connection download speed from the console over the ssh session without using HTML5 or Adobe flash/Java applets based websites? How do I test my upload speed from the console?
I recommend that you use lftp command to test Internet upload and download speed from console. You can run lftp using the ssh client:
[a] wget command – Retrieves files from the web (download speed test).
[b] wput command – A tiny wget-like ftp-client for uploading files (upload speed test).
How To Test Internet Connection Speed From SSH Command on Linux or Unix
You can use the following yum command to install lftp and iperf under RHEL / CentOS / Fedora Linux: # yum install lftp iperf OR use the following apt command/apt-get command under Debian or Ubuntu Linux/Mint Linux: $ sudo apt-get install lftp iperf
Step 1. Find out download url
You need a large size file to test download speed. For example, you can visit the home page of “Linux kernel” to grab Centos Linux ISO file.
In this example, I am uploading a file to my private ftp server:
lftp -u admin homeserver -e 'cd video; put /home/vivek/Downloads/debian-testing-amd64-CD-1.iso; bye'
lftp -u admin homeserver.public.ip.here -e 'cd video; put /home/vivek/Downloads/debian-testing-amd64-CD-1.iso; bye'
How do I test network throughput rate between two Linux or Unix servers?
Consider the following setup:
| Linux server A +--------- ISP Internet-----------+ Linux server B +
iperf server iperf client
Iperf is a tool to measure maximum TCP bandwidth, allowing the tuning of various parameters and UDP characteristics. Iperf reports bandwidth, delay jitter, datagram loss. On server A start iperf as follows: # iperf -s -B 18.104.22.168 On server B type the same command as follows: # iperf -c 22.214.171.124 -d -t 60 -i 10 Sample outputs:
-s : Run in server mode.
-B IP : Bind to IP, an interface or multicast address.
-c IP : Run in client mode, connecting to IP.
-d : Do a bidirectional test simultaneously.
-t 60 : Time in seconds to transmit for (default 10).
-i 10 : Pause n seconds between periodic bandwidth reports.
And there you have it. We just test Internet connection speed from SSH command or ssh based session or just old good terminal from your Linux or Unix desktop. See the following man pages for information: man lftp man wget man iperf
The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.