Linux Networking tips and tricks: cURL

Here is another post of the series on basic network troubleshooting and tools under Linux.

In this post, I will talk about the cURL command.

Other posts of the series

This post is part of a series of Linux Networking tips and tricks.
The other posts of this series are:

  1. The ip and nmcli commands
  2. The mtr command
  3. The ss and netstat commands
  4. The curl command
  5. tcpdump


What is cURL?

cURL is a Linux command-line tool for getting or sending data and files, using an URL syntax.

Since cURL uses libcurl, it supports every protocol libcurl supports, like: DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, Telnet and TFTP.

cURL supports also SSL certificates, HTTP POST/PUT, FTP uploading, HTTP form based upload, proxies, HTTP/2, HTTP/3, cookies, user+password authentication (Basic, Plain, Digest, CRAM-MD5, NTLM, Negotiate and Kerberos), file transfer resume, proxy tunneling and more.

cURL was first released in 1997 and was originally named httpget. Then it became urlget before adopting the current name of cURL. The original author and lead developer is the Swedish developer Daniel Stenberg, who created cURL because he wanted to automate the fetching of currency exchange rates for IRC users (source WikiPedia).


What’s curl used for?

The cURL command is used in command line or scripts to transfer data. It is also used in many IoT and connected devices and is the Internet transfer backbone for thousands of software applications affecting billions of humans daily.

For network engineers, it is very valuable for testing purposes, for example to make API queries from the command line or to test a website status.


How to use curl?

I cannot cover all the options for using curl, because there are so many. But instead, I will provide below some useful examples of how to use cURL in day-to-day operations.


Most basic, download a single file from a web site:

$ curl


To download a file and specify a new local filename (-o option):

$ curl -o


Download multiple files at once, from multiple locations (-O option is to keep the original filename):

$ curl -O -O -O


To download all sequentially numbered files (files 1-24 in this example):

$ curl[1-24].xyz


Download a file and follow redirect if needed (-L option):

$ curl -L


To download a file and pass HTTP Authentication (-u option):

$ curl -u username:password URL


Download a file with a Proxy (-x option):

$ curl -x http://address-i-want-to.access


To download a file from a FTP server with authentication (-u again for the authentication and -O to keep the original file name):

$ curl -u username:password -O


Upload a file to a FTP server with authentication (-u for the authentication and -T for Transfer option):

$ curl -u username:password -T image.png


Get an FTP directory listing:

$ curl


Resume a previously failed or aborted download (-C option to resume the transfer and -o to define the local file name):

$ curl -C - -o

As we saw, the lowercase -o option save the file with a different name. Here we can also use the original remote file name using the uppercase -O option.


Fetch only the HTTP headers from a response (-I option):

$ curl -I

This is useful to check the status of a website, in combination with -s option (silent) and -L to follow the redirect, if any.

This is also useful to see the location of a tiny url, for example:

$ curl -sIL | grep "^location"


Limit the download rate speed (–limit-rate option):

$ curl --limit-rate 100B -O


POST to a http form (-F option)

$ curl -F "username=user" -F "password=test"

Use the format: form_field_name=content with -F


POST request, for example for an API (–data or -d for HTTP post and -X POST for the request option)

$ curl --data -X POST "param1=value1"

We can also specify the content type with -H header option, and -d for data option, for example for JSON data:

$ curl -H "Content-Type: application/json" -X POST -d '{"user":"joe","pass":"xyz"}'



How to have fun with curl?

After having seen examples how to work with cURL, here are some cooler examples.


Get the local weather report in command line

Simple as:

$ curl

Get the weather report of the city you like:

$ curl<city>

You can use the city name, zip or airport code, for example: $ curl



You can use the short version also:

$ curl
Zurich: ⛅️ +22°C

Or get an image of this report:

$ curl --output London.png

In another format:

$ curl --output London.png

Get the local daily graph of temperature and precipitation:

$ curl




To see the moon status:

$ curl



Make a qrcode in command line

Base is:

$ curl

For example:

$ curl


Cheat Sheet:

$ curl

For example, you need cheat sheet on curl:

$ curl

Or for vim:

$ curl

And much more…


To get Cryptocurrencies exchange rate in cli

Cryptocurrencies exchange rate:

$ curl


Bitcoin exchange rate:

$ curl


Ethereum exchange rate:

$ curl



Get your current IP address (external IP)

$ curl

The same in JSON or XML formats:

$ curl
$ curl

Go to for more options.


Get your current (external) IP, IP based geo location, AS number of your ISP, and much more

$ curl


Read more


Everything curl – the book

Everything curl is an extensive, detailed and totally free book, available in multiple formats, here:

The web version of the book is here:


Other sources used in this post


Other posts of the series

This post is part of a series of Linux Networking tips and tricks.
The other posts of this series are:

  1. The ip and nmcli commands
  2. The mtr command
  3. The ss and netstat commands
  4. The curl command
  5. tcpdump


Did you like this article? Please share it…



  1. jsh3323

    Missing the i in ifconfig in the “The same in JSON or XML formats:” section

Leave a Reply

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