Linux Curl Command

Source: Internet
Author: User

Yum Install Curl

Curl is a file transfer tool that works under the command line using URL rules, which can be said to be a powerful HTTP command-line tool. It supports file upload and download, is a comprehensive transfer tool, but by tradition, the custom called URL for download tool.

Http://man.linuxde.net/curl

Common examples:

File Download

The Curl command can be used to perform downloads, send various HTTP requests, specify HTTP headers and so on, andcurl prints the downloaded file to stdout and outputs the progress information to stderr.

Curl URL--silent #--silent Show progress Information  

Curl http://man.linuxde.net/text.iso--silent-o Option #-o write to file, must be absolute path

Curl Http://man.linuxde.net/test.iso-o filename.iso--progress #-o Specify the file and use --progress to display the progress bar

######################################### 100%

Breakpoint Continuation

Curl can continue downloading from a specific file offset, and it can download portions of the file by specifying an offset.

Curl Url/file-c Offset #偏移量是以字节为单位的整数

Curl-c-url # -C- lets curl automatically infer the correct continuation location

To set a reference page string using Curl  

The reference page is a string in the HTTP header that indicates to which page the user reached the current page, and if the user clicks on a connection in page A, the user jumps to page b, and the reference page string in page b contains the URL of page A. Use the--referer option to specify the reference page string:

Curl--referer http://www.google.com http://man.linuxde.net #表示用户从谷歌跳到man的

set up cookies with Curl

Use the--cookie "cokkies" option to specify a cookie, with multiple cookies separated by semicolons:

Curl http://man.linuxde.net--cookie "user=root;pass=123456"

To save the cookie as a file, use the--cookie-jar option:

Curl URL--cookie-jar Cookie_file

Set the user agent string with Curl

Some Web site access will prompt only use Internet Explorer to access, this is because these sites set up to check the user agent, you can use curl to set the user agent as IE, so that you can access. Use--user-agent or-a option: Curl URL--user-agent "mozilla/5.0"

Curl Url-a "mozilla/5.0"

Other HTTP header information can also be sent using curl, using the-H "header information" to pass multiple header information, for example:

Curl-h "Host:man.linuxde.net"-H "ACCEPT-LANGUAGE:ZH-CN" URL

Bandwidth control and download quotas for curl

Curl URL--limit-rate 50k #--limit-rate limit the download speed of curl, available in K and m specified units

Curl URL--max-filesize bytes #--max-filesize Specifies the download file size, if the size exceeds the limit, the command returns a non-0 exit code

using Curl for authentication

Use the Curl Option-U to complete HTTP or FTP authentication, you can specify a password, or you can enter a password in subsequent operations without specifying a password

Curl-u user:pwd http://man.linuxde.net

Curl-u User Http://man.linuxde.net

Print only the response header information

Curl-i Http://man.linuxde.net # can only print out HTTP header information via-I or-head

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/8C/4F/wKiom1hp_M_y21dMAADgGFWjRak962.png "title=" 1.png " alt= "Wkiom1hp_m_y21dmaadggfwjrak962.png"/>

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/8C/4B/wKioL1hp_NrA1MZuAADJMDDD-fc565.png "title=" 2.png " alt= "Wkiol1hp_nra1mzuaadjmddd-fc565.png"/>

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/8C/4B/wKioL1hp_OWxjjTgAADqo7hz_bE987.png "title=" 3.png " alt= "Wkiol1hp_owxjjtgaadqo7hz_be987.png"/>






This article is from the "North Ice--q" blog, please be sure to keep this source http://beibing.blog.51cto.com/10693373/1888300

Linux Curl Command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.