in

LinuxLinux

20+ CURL Linux Commands 2019 For Ubuntu 18.04 & All Linux Distros

Essential CURL Linux Commands

Reading Time: 7 minutes

C

URL Command: It is a Linux Terminal Command mainly used to transfer the data from one server to another server. This CURL Command is an useful Terminal command line utility and mainly used to download and upload from to the server. In this tutorial, We added 20+ best examples to use the CURL command effectively in Linux.

The below CURL commands are tested on Ubuntu 19.04 Disco Dingo edition and Ubuntu 18.04. There are more than 20+ CURL commands are available and it will be updated in another article.

Jump To:

Best CURL Linux Commands:

Follow the below commands to test the CURL commands on Linux and its distros.

Use Basic CURL Command:

The CURL is mainly used to get the content from one server to another server. You can get the source code of any websites or server by using the CURL command.

$curl https://www.tecrobust.com

The above command will get you the Source code of the “Tecrobust.com” in the Linux terminal. This CURL command will work as a browser in the Linux terminal. Copy the above command & replace the “https://www.tecrobust.com” with your own URL or IP address.

Basic Linux CURL
Basic Linux CURL

Store File Using CURL:

You can simply store the output file from the above output by following the below command.

$curl https://www.tecrobust.com > tecrobust.html

The CURL command will help you get the source code of the URL that you provided and adding the ” > tecrobust.html “, will help you store the source code under the filename of tecrobust.html in your Linux pc. You can replace the tecrobust.html with your own name and file format.

Store File using CURL
Store File using CURL

CURL -o Command Usage:

$curl -o tecrobust.html https://www.tecrobust.com

You can use the “-o” option to download or store the data to a specific file.

curl -o Command
curl -o Command

CURL -O (Capital O) Command Usage:

(Capital O) “CURL -O” will help you save the downloaded data in a file with the same name.

$curl -O https://www.g7website.com/website-categories/html-websites.html

The above command “curl -O” will save the downloaded data in a file named ‘websites.html’.

CURL -O Command
CURL -O Command

Mute CURL Command Output:

If you want to make your terminal clear while processing the CURL commands and then you need to follow the below command to mute the CURL process. The below command will also mute the process of CURL Errors.

$curl -s https://neverssl.com
CURL SSL Error
CURL SSL Error

The above image shows that the SSL error while using the CURL command on Linux Terminal, To minimize the error just add the “-s” code with CURL. “ -s ” will minimize the error displays in the terminal.

CURL Error Mute
CURL Error Mute

As you see in the above image the error have been muted in the terminal. If you want to see the error run the same command but add the “-S” ( Capital S) with the command and execute.

$curl -s -S https://neverssl.com
To Display CURL Error
To Display CURL Error

The above image shows CURL with errors. Simply use the “-s  -S” along with CURL.

Store/Download Multiple Files From Website or Server:

By using the CURL you can able to store or download data from more than one websites. Just simply follow the below commands to enable multiple downloads using CURL command.

$curl -O https://www.g7website.com/testimonials.html -O https://www.g7website.com/showcase.html
Multiple Download using CURL
Multiple Download using CURL

You can use the -o or -O to download multiple files using CURL.

URL 301 Redirect Using CURL:

Website nowadays having SSL encryption to maintains the user data security and so every website has HTTPS connection nowadays. Before this, website only having the port 80 connection ( HTTP ) only. If you are familiar with only HTTP connection and CURL will throw you the Redirection error instead of downloading the file.

CURL 301 Error
CURL 301 Error

To minimize this error, -L command line option. This command will handle your 301 redirection errors in terminal.

$curl -L google.com

The above command will minimize the 301 error occurring on CURL action.

Minimize 301 redirection Error CURL
Minimize 301 redirection Error CURL

CURL -V Command:

You can view the full process behind the CURL operation. By simply adding the “-v” command with CURL option to view the complete process behind the CURL.

$curl -v https://www.tecrobust.com
-v CURL Command
-v CURL Command

The above image shows that the usage of “-v” command with curl, which helps you to see the complete process behind the CURL operation.

  • * – additional information provided by the tool.
  • > – display the header data which is sent
  • < – display the header data which is received

To find more information behind the CURL process we recommend you use them --trace option.

--trace CURL Command:

The --trace option will provide you the more information behind the CURL option.

$curl --trace info https://www.tecrobust.com
CURL - - trace Command
CURL – – trace Command

Find Word Meaning Using DICT Protocol With CURL Command:

By using this command, you can look up for a word on the terminal using dict protocol. A dictionary server dict.org URL is passed to it.

$curl dict://dict.org/show:db
Look up meaning for word using CURL
Look up meaning for a word using CURL

To search a word in a specific dictionary, use the following command:

$curl dict://dict.org/d:command:gcide

To search a word in all the dictionaries, run the following command:

$curl dict://dict.org/d:command:*

Using Proxy URL to Download Data:

$curl -x http://proxyserver.com:8080 download_URL

The above command will help you to download the data files from the proxy servers. “-x” informs the CURL need to use the proxy server to download data files.

CURL to Limit Download Rate:

$curl --limit-rate 2048B -O file_download_URL

The above command will limit the downloading speed of data from the download URL.

 CURL to Authenticate After File Download:

$curl -u username:password download_URL

The “-u” enables the password authentication after the file has been download using CURL.

Resuming Download Using CURL:

$curl -C File_download_URL

The above command can be used when you are trying to download a large file from the server or if you have a low internet connection speed and then the above command will help you resuming the download process using CURL.

Download Files from FTP Server Using CURL:

$curl -u ftpuser:password -O ftp://ftp_pub_IPA/public/index.php

The above command will help you download the files from the FTP server. You need to provide the proper authentication username and password to download the files from FTP server.

Upload files to FTP Server using CURL:

$curl -u ftpuser:password -T index.php ftp://ftp_pub_IP/public/

The above command will help you upload the files onto the FTP server.

Verify SSL Connection using CURL:

$curl --cacert new-ca.crt File_download_URL

The above command will help you verify the SSL Certificate of download file URL.

Ignore SSL Warning using CURL:

$curl -k File_download_url

The above command will help you ignore SSL warning while using CURL for downloading the file from the server.

Verdict:

That’s it, The above 20+ CURL Linux Commands will help you to perform some important tasks in Linux Ubuntu. If you have any queries or need an update in this article and kindly contact us.

Article Review
  • 95%
    Command Listed - 95%
  • 99%
    Commands Working - 99%
  • 90%
    Image Explanation - 90%
95%

Summary

For more article, kindly visit our Homepage

What do you think?

0 points
Upvote Downvote

Written by Mike

Seeker of nature. For me, everything is about nature. Loves to gaze through different scapes, weather and admire the colors of nature. Contact me through the Contact Us adding "@Mike" on the Subject box.

Comments

Leave a Reply

Loading…

Loading…

0

Comments

0 comments

Install Kodi 18.2 Leia[Stable] on Linux Ubuntu 19.04/ 18.04.2 LTS

PHP-7.2 CURL

How To Install PHP-7.2 CURL On Ubuntu 18.04, 18.04.2 & 19.04 Edition