Best Command Line HTTP Client for Linux


In this tutorial, we will explore some of the most commonly used and famous HTTP clients that are present in Linux. A HTTP Client is a software that is mainly used to allow us to download files from the Internet. The primary reason for using HTTP clients is generally to download files, but these can also be used in case we want to debug or interact with a web server or multiple web servers.

Now, let's consider the most famous HTTP Clients that are used.

HTTPie

With the name that almost resembles of the famous web protocol (i.e., HTTP), HTTPie, is command line HTTP Client that helps us when it comes to interacting with web services, and RESTful APIs. It is said that it provides a much simpler interface that is very user friendly and easy to use even for someone who hasn't used it before.

With being a simple and easy to use client, it also provides custom headers, plugin support, JSON built-in support and colorized syntax as well and much more.

In case we want to make use of HTTPie client, the first step is to install the same on our local machine.

How to Install HTTPie?

Consider the command shown below. If you are using a Debian/Ubuntu distribution, then you can use the following command to install HTTPie.

apt-get install httpie

If you are using a CentOS/RHEL distribution, then you can make use of the command shown below to install HTTPie.

yum install httpie

Once you have installed the HTTPie client, you can use it with the following syntax

http [options] [method] URL [ITEM]

HTTP Prompt

HTTP Prompt is command line HTTP Client that is built on top of prompt_toolkit and HTTPie that introduces more than 20+ themes. It has many features like auto-complete, syntax highlighting, http-prompt persists in-between the different sessions, auto cookies and much more.

In case you want to use the HTTP Prompt client, the first step is to install the same on your local machine.

Consider the command shown below. If you are using a Debian/Ubuntu distribution, then you can use the following command to install HTTP Prompt.

sudo pip install http-prompt

Once you have installed the HTTP Prompt client, you can use it with the following syntax

http [options] URL [ITEM]

In case you need to update the version of HTTP Prompt, use the following command −

pip install -U http-prompt

Curl

Curl is also a common line utility like the two http clients mentioned above and is mainly used when we want to transfer files over a network using a URL. It supports different protocols, like HTTPS, IMAP, LDAP, POP3 etc.

It is a very popular utility that is mainly used not only in terminals but also when it comes to tablets, mobile phones, audio equipment, and much more.


For example, you can use the following curl command to check its version.

curl -V

It will produce the following output 




curl 7.77.0 (x86_64-pc-linux-gnu) libcurl/7.77.0 (SecureTransport) LibreSSL/2.8.3
zlib/1.2.11 nghttp2/1.42.0
Release-Date: 2021-05-26
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt
pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS GSS-API HSTS HTTP2 HTTPS-proxy IPv6 Kerberos
Largefile libz MultiSSL NTLM NTLM_WB SPNEGO SSL UnixSockets

Wget

Wget is a Linux command line utility that is used to retrieve files from World Wide Web(WWW) and makes use of protocols like HTTPS and FTP. It is a freely available package and can be downloaded and installed on any Linux supporting architecture.

One of the key features of wget is its ability to automatically start downloading where it was left off in case there is a network issue. It should also be noted that it deletes files recursively and it will keep trying to download all the files until it has been retrieved completely.

How to Install Wget

If you are using an Ubuntu/Fedora distribution, then use the following command −

sudo apt-get install wget

If you are on Mac OS X, then use the following command −

yum install wget


Now, let’s take an example. You can use the following wget command to download a file from a URL:


It will produce the following output

immukul@192 linux-code % wget http://ftp.gnu.org/gnu/wget/wget-1.5.3.tar.gz
--2021-07-11 12:12:20-- http://ftp.gnu.org/gnu/wget/wget-1.5.3.tar.gz
Resolving ftp.gnu.org (ftp.gnu.org)... 209.51.188.20
Connecting to ftp.gnu.org (ftp.gnu.org)|209.51.188.20|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 446966 (436K) [application/x-gzip]
Saving to: 'wget-1.5.3.tar.gz'

wget-1.5.3.tar.gz
100%[========================================================>]
436.49K 285KB/s in 1.5s
2021-07-11 12:12:23 (285 KB/s) - 'wget-1.5.3.tar.gz' saved [446966/446966]

Aria2

Aria2 is another command line utility that supports different protocols that allows us to transfer files over the internet. It has many features, like parallel downloading of files, automatic validation for files, IPv6 support and much more.

In case you want to use an Aria2 client, you have to first install it on your local machine.

How to Install Aria2?

If you are using a Debian/Ubuntu distribution, then use the following command to install Aria2 −

apt-get install aria2

On the other hand, if you are using a CentOS/RHEL distribution, then you can use the following command −

yum install aria2 -y

You can use the following syntax when working with Aria2 −

Aria2c [url]

Conclusion

In this tutorial, we explored different examples of the most commonly used HTTP clients that are available for Linux today.

Updated on: 22-Jul-2022

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements