Linux cURL Command

Linux cURL Command

cURL Commands:

cURL is a simple software package that consist of a command line tool for sending or receiving data using URL. It is a simple to use command line tool for sending and receiving files that supports the all main protocols that are FTP, GOPHER, HTTP, FTPS, HTTPS, DICT, IMAP, LDAP, IMAPS, POP, RTMP, SCP, RTSP. SMTP,TELENT, SMTPS, TFTP, LDAPS, and POP3S. You can use cURL into the shell script. It have 120 command line tool. It has the extra feature to resume and pause of downloads. It supports the all major operating system. cURL command line supports the configuration files. You can upload multiple files with single command. You can download the multiple files at same time with the use of cURL Command. cURL commands use the same TCP for downloading the files.

cURL Commands with Examples :

1. For Downloading Single File:

The command is used to download the content of URL and display it on your terminal.

Syntax:

$ curl http://www.hostingindia.org

2. Saving the cURL Output to File:

You can save the url output in a file using the following command. You can save the output by using –o/- O options with cURL command.

Syntax:

$ curl – o mytext.html http://www.get.org/software/text/manual/mygettext.html

By using above command you can save the mytext file in the mygettext.html.

3. Fetching the multiple file at same Time:

You can download files at the same time using the given command.

Syntax:

$ curl – o URL1 – o URL2

4. Redirects the HTTP Location Headers with – L option:

Curl doesn’t follow the location of http header. When a web page that is requested is moved one place to another then it will be sent the http header location like response. Curl redirects the HTTP header location.

For instance when you type yahoo.com in your browser in India then it will be redirects to yahoo.co.in automatically. It is done by simply applying the given command:

Syntax:

$ curl http://www.yahoo.com

<Title> 302 moved</Title>

<H1> 302 moved </H1>


Document has moved

< a href =http://www.yahoo.co.in> here</a>

It will show the output is the requested document is moved on http://www.yahoo.co.in

5. Start Resume Download:

In some case when you need to download a large file and the download is stopped in between for some reason. If you want to download the file where it is stopped then you can use the command curl with – C option.


For Instance you have to start the download a file and stop it in between by using the Ctrl – C

Syntax:

$ curl - o http://www.mgsu.org/software/gettext/manual/gettext.html

########## 18%

After that you can execute curl command with – C option for start downloading from where you stop that.

Syntax:

Curl – C - - o httpl://www.mgsu.org/software/gettext/manual/gettext.html.

######### 19%

6. Set Limit of Data Transfer:

You can also set the limit of data transfer rate via using the curl command with limit rate option. You can set the average data transfer rate that is 1000 bytes per second. For set the limit follow the given command.

Syntax:

$ curl - - limit – rate 1000B –0
http://mgsu.org/software/gettext/maual/gettext.html.

7. Passing Authentication in cURL:

In some case, website needs username and password for viewing the content than you can use the curl with – u option.

Syntax:

$ curl – u username: password http://www.mgsu.org.

8. Downloading files from FTP Server:

If you want to download files from FTP server then you can use the given command .

Syntax:

$ curl – u ftpuser: ftppass –o fttp:// ftp_server/public_html/xss.php.

9. Getting the Information of a Word:

You can get the information about a word via using the cURL DICT protocol. For getting definition of word you have to pass the url of dictionary Server to the DICT protocol.

Syntax:


$ curl dict://dict.org/d:shell

10.Downloading a File Using Proxy:

You can download a file from proxy by simply defining the cURL to use the proxy for downloading the file. Follow the given command.

Syntax:

$ curl – x proxyserver.mytext.com:3128 http://google.co.in.
Author
Jaishree
Views
4,107
First release
Last update
Rating
0.00 star(s) 0 ratings
Top