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?

Tutorial details
Difficulty Easy (rss)
Root privileges No
Requirements lftp or wget+wput/ftp
Time N/A
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). [c] axel – Another light download accelerator. [d] iperf command – Perform network throughput tests. [c] speedtest-cliCheck the Internet speed with Python based CLI tool called Speedtest-cli.

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.

Step 2. Use lftp command to test download speed

The syntax is:

lftp -e 'pget; exit; '
lftp -e 'pget; exit; '
lftp -e 'pget; exit; '

Sample outputs:

Fig.01: lftp testing internet speed

You will also get the report as follows:
725617504 bytes transferred in 65 seconds (10.63M/s) 

A note about wget command

You can use the wget command as follows for testing download speed:
$ wget -O /dev/null
Sample outputs:

Fig.02: wget command in action

Step 3. Use lftp command to test upload speed

The sytnax is as follows:

lftp -u userName -e 'put largecd1.avi; bye' 
lftp -u userName,passWord -e 'put largecd1.avi; bye' 
lftp -u userName,passWord -e 'put /path/to/large.iso; bye'

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 -e 'cd video; put /home/vivek/Downloads/debian-testing-amd64-CD-1.iso; bye'

Sample outputs:

Fig.03: lftp upload speed test in action

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 +
+------------------+                                  +----------------+
IP:                                         IP:
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
On server B type the same command as follows:
# iperf -c -d -t 60 -i 10
Sample outputs:

Fig.04: iperf client in action

  1. -s : Run in server mode.
  2. -B IP : Bind to IP, an interface or multicast address.
  3. -c IP : Run in client mode, connecting to IP.
  4. -d : Do a bidirectional test simultaneously.
  5. -t 60 : Time in seconds to transmit for (default 10).
  6. -i 10 : Pause n seconds between periodic bandwidth reports.
Recommended readings

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

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 11 comments so far... add one

CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
11 comments… add one
  • Phron Jan 5, 2013 @ 0:23

    this is awesome information…
    and i’m learning a lot with your work!!
    Thank you very much!!!

  • Deltaray Mar 7, 2013 @ 14:14

    What does ssh have to do with lftp? They are from different packages.

  • Thái Snake Oct 24, 2013 @ 15:48

    I allways use “wget” to check the speed, but i don’t know if have any reason affect the results.
    My connection is 100Mbps, i allways download the link from my country, but, the speed only 9-10MB/s. And when i check on windows server, the speed if max 11-12MB/s

  • Zaman Nov 15, 2013 @ 16:13

    Dear sir,

    Actually, 100Mbps is represented in bit and 12MBytes.
    if you divide 100Mbit / 8 = 12 MByte
    because 1Byte = 8bits

    hop you can understand

    • guajiro Aug 5, 2015 @ 3:13

      100/8 = 12.5, actually

  • ravi Dec 18, 2013 @ 13:09


    I´would like to know whether the iperf is used to find the bandwidth of the bluetooth file transfer rate?. I was trying to find the bandwidth while transfering the file from ARM linux board via Bluetooth to host PC or mobile.

    If there are any other possibility would be appreciated.
    Thank you in advance.

  • Roman Mar 27, 2014 @ 15:22

    could it work on openWrt ?
    if so can I get the source code ?

  • yayaska Apr 18, 2014 @ 6:21

    The best way to test is to download and use it under python
    # wget -O

    then start the command
    # python

    I hope this will work for you.
    need more help reply to my post

    • mH~ Aug 24, 2014 @ 1:28

      Root privileges are not needed. :P

  • David Ford Aug 24, 2014 @ 10:15

    Sweet..thanks for the info…almost a Linux-Fu Orange Belt…:D

  • lalala Aug 24, 2014 @ 11:12

    you can also use `axel` utility

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @