How to Check Internet Speed (Download/Upload) Right from Your Linux Terminal?

If you would like to troubleshoot an issue with slow Internet access on your Linux system, it would be a good idea to measure the current Internet speed.

Most of the users know about speedtest.net that helps testing our internet bandwidth using speedtest-cli in Linux. To do so, we need to install the speedtest cli.

You may need to run this test to measure that you are getting a right speed when you buying a new internet connection.

But, by default Linux allow us to do the same with their native commands. It can be done in many ways but i have listed set of commands, which i use frequently.

These commands are allows you to test internet speed right from your Linux terminal.

  • wget Command: Wget (formerly known as Geturl) is a Free, open source, command line downloader.
  • curl Command: Curl is similar to wget and doesn’t support multi-threading but surprisingly make the download much faster compare with wget.
  • aria2 Command: Aria2 is a lightweight multi-protocol & multi-source command-line download manager/utility for Linux.
  • axel Command: Axel is a lightweight download utility, it does the same thing how other accelerator does.
  • lftp Command: lftp is a file transfer program that allows sophisticated FTP, HTTP and other connections to other hosts.

1) How to Check Download Speed in Linux Using wget Command?

wget Command (formerly known as Geturl) is a Free, open source, command line downloader which is retrieving files using HTTP, HTTPS and FTP, the most widely-used Internet protocols. It is a non-interactive command line tool and Its name is derived from World Wide Web and get.

Wget handle download pretty much good compared with other tools, even it doesn’t support multi-threading and futures included working in background, recursive download, multiple file downloads, resume downloads, non-interactive downloads & large file downloads.

By default all the Linux Distribution included wget, so we can install easily from official repository, also we can install to windows and Mac OS too.

Wget has been designed for robustness over slow or unstable network connections, if a download fails due to a network problem, it will keep retrying until the whole file has been retrieved. If the server supports regetting, it will instruct the server to continue the download from where it left off.

# wget https://speed.hetzner.de/100MB.bin
--2019-07-29 10:54:15--  https://speed.hetzner.de/100MB.bin
Loaded CA certificate '/etc/ssl/certs/ca-certificates.crt'
Resolving speed.hetzner.de (speed.hetzner.de)... 88.198.248.254, 2a01:4f8:0:59ed::2
Connecting to speed.hetzner.de (speed.hetzner.de)|88.198.248.254|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 104857600 (100M) [application/octet-stream]
Saving to: ‘100MB.bin’

100MB.bin                                            100%[=====================================================================================================================>] 100.00M   995KB/s    in 2m 14s  

2019-07-29 10:56:30 (765 KB/s) - ‘100MB.bin’ saved [104857600/104857600]

2) How to Check Download Speed in Linux Using curl Command?

curl Command is similar to wget and doesn’t support multi-threading but surprisingly make the download much faster compare with wget.

curl is a tool to transfer data from a server or to server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP).

The command is designed to work without user interaction. Also curl support proxy support, user authentication, FTP upload, HTTP post, SSL connections, cookies, file transfer resume, Metalink, and more. curl is powered by libcurl for all transfer-related features.

If you specify URL without protocol:// prefix, curl will attempt to guess what protocol you might want. For example, host names starting with “ftp.”curl will assume you want to speak FTP. If it’s not find specific protocol, then do default to HTTP.

# curl -O https://speed.hetzner.de/100MB.bin
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  100M  100  100M    0     0   855k      0  0:01:59  0:01:59 --:--:--  906k

3) How to Check Download Speed in Linux Using aria2 Command?

aria2 Command is a lightweight multi-protocol & multi-source command-line download manager/utility for Linux, Windows & Mac OSX. It supports HTTP/HTTPS, FTP, SFTP, BitTorrent and Metalink. aria2 can be manipulated via built-in JSON-RPC and XML-RPC interfaces.

It supports multi-threading and uses multiple sources/protocols to download files which really speeds up your download and complete the download as much as possible.

It’s very lightweight and doesn’t require much memory and CPU. We can use as a BitTorrent Client because it has all the features you want in BitTorrent client.

# aria2c https://speed.hetzner.de/100MB.bin

07/29 11:15:58 [NOTICE] Downloading 1 item(s)
 *** Download Progress Summary as of Mon Jul 29 11:16:58 2019 ***                                                                                                                                                 
==================================================================================================================================================================================================================
[#8672d7 62MiB/100MiB(62%) CN:1 DL:1.2MiB ETA:31s]
FILE: /home/daygeek/100MB.bin
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[#8672d7 99MiB/100MiB(99%) CN:1 DL:488KiB]                                                                                                                                                                        
07/29 11:17:53 [NOTICE] Download complete: /home/daygeek/100MB.bin

Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
8672d7|OK  |   894KiB/s|/home/daygeek/100MB.bin

Status Legend:
(OK):download completed.

4) How to Check Download Speed in Linux Using axel Command?

axel Command is a lightweight download utility, it does the same thing how other accelerator does. It opens multiple connections for one file and each connections download separate file fragment to complete the download more quickly.

Axel supports HTTP, HTTPS, FTP and FTPS protocols. It can also use multiple mirrors for single file download. So, Axel can speed up a download up to 40% (approximately, i personally realized). It’s very lightweight because no dependencies and uses very less CPU & RAM.

Axel downloads all the data directly to the destination file, using one single thread.

Note : There is no option to download the two file in single command.

# axel https://speed.hetzner.de/100MB.bin
Initializing download: https://speed.hetzner.de/100MB.bin
File size: 104857600 bytes
Opening output file 100MB.bin
Starting download

[  0%]  .......... .......... .......... .......... ..........  [  56.1KB/s]
[  0%]  .......... .......... .......... .......... ..........  [ 122.6KB/s]
[  0%]  .......... .......... .......... .......... ..........  [ 156.3KB/s]
[  0%]  .......... .......... .......... .......... ..........  [ 198.8KB/s]
[  0%]  .......... .......... .......... .......... ..........  [ 243.1KB/s]
[  0%]  .......... .......... .......... .......... ..........  [ 257.3KB/s]
[  0%]  .......... .......... .......... .......... ..........  [ 295.6KB/s]
.
.
[ 99%]  .......... .......... .......... .......... ..........  [1010.0KB/s]
[ 99%]  .......... .......... .......... .......... ..........  [1009.9KB/s]
[ 99%]  .......... .......... .......... .......... .......
Connection 1 finished
        ,,,,,,,,,, ,,,,,,,,,, ,,,,,,,,,, ,,,,,,,,,, ,,,,,,,...  [1009.7KB/s]
[ 99%]  .......... .......... .......... .......... ..........  [1009.8KB/s]
[ 99%]  .......... .......... .......... .......... .........
Connection 0 finished
        ,,,,,,,,,, ,,,,,,,,,, ,,,,,,,,,, ,,,,,,,,,, ,,,,,,,,,.  [1010.0KB/s]
[ 99%]  ....
Connection 3 unexpectedly closed
        ,,,,...... .......... .......... .......... ..........  [1008.8KB/s]
[ 99%]  ...
Connection 2 finished
        ,,,....... .......... .......... .......... ..........  [ 991.3KB/s]
[ 99%]  .......... .......... .......... .......... ..........
Connection 1 finished

Downloaded 100 Megabyte(s) in 1:47 minute(s). (956.69 KB/s)

5) How to Check Download/Upload Speed in Linux Using lftp Command?

lftp is a file transfer program that allows sophisticated FTP, HTTP and other connections to other hosts.

If site is specified then lftp will connect to that site otherwise a connection has to be established with the open command.

lftp can handle several file access methods – FTP, FTPS, HTTP, HTTPS, HFTP, FISH, SFTP and file (HTTPS and FTPS are only available when lftp is compiled with GNU TLS or OpenSSL library). You can specify the method to use in `open URL’ command

How to Check a Download Speed in Linux Using lftp Command?

# lftp -e 'pget http://centos.excellmedia.net/6.5/isos/x86_64/CentOS-6.5-x86_64-LiveCD.iso; exit;'
680532375 bytes transferred in 67 seconds (9.71M/s)

How to Check a Upload Speed in Linux Using lftp Command?

# lftp -u 2gadmin 2g.server.com:/public_html -e 'put /home/mageshm/CentOS-6.5-x86_64-LiveCD.iso; bye'
Password: ******
cd ok, cwd=/public_html
680525824 bytes transferred in 58 seconds (11.18M/s)

About Magesh Maruthamuthu

Love to play with all Linux distribution

View all posts by Magesh Maruthamuthu

Leave a Reply

Your email address will not be published. Required fields are marked *