📄 curl.html
字号:
<html><head><title>curl man page</title><meta name="generator" content="roffit 0.7"><STYLE type="text/css">P.level0 { padding-left: 2em;}P.level1 { padding-left: 4em;}P.level2 { padding-left: 6em;}span.emphasis { font-style: italic;}span.bold { font-weight: bold;}span.manpage { font-weight: bold;}h2.nroffsh { background-color: #e0e0e0;}span.nroffip { font-weight: bold; font-size: 120%; font-family: monospace;}p.roffit { text-align: center; font-size: 80%;}</STYLE></head><body><p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2><p class="level0">curl - transfer a URL <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2><p class="level0"><span Class="bold">curl [options]</span> <a class="emphasis" href="#URL">[URL...]</a> <a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2><p class="level0"><span Class="bold">curl</span> is a tool to transfer data from or to a server, using one of the supported protocols (HTTP, HTTPS, FTP, FTPS, TFTP, DICT, TELNET, LDAP or FILE). The command is designed to work without user interaction. <p class="level0">curl offers a busload of useful tricks like proxy support, user authentication, ftp upload, HTTP post, SSL (https:) connections, cookies, file transfer resume and more. As you will see below, the amount of features will make your head spin! <p class="level0">curl is powered by libcurl for all transfer-related features. See <span Class="manpage">libcurl (3)</span> for details. <a name="URL"></a><h2 class="nroffsh">URL</h2><p class="level0">The URL syntax is protocol dependent. You'll find a detailed description in RFC 3986. <p class="level0">You can specify multiple URLs or parts of URLs by writing part sets within braces as in: <p class="level0"> <a href="http://site">http://site</a>.{one,two,three}.com <p class="level0">or you can get sequences of alphanumeric series by using [] as in: <p class="level0"> <a href="ftp://ftp.numericals.com/file">ftp://ftp.numericals.com/file</a>[1-100].txt <a href="ftp://ftp.numericals.com/file">ftp://ftp.numericals.com/file</a>[001-100].txt (with leading zeros) <a href="ftp://ftp.letters.com/file">ftp://ftp.letters.com/file</a>[a-z].txt <p class="level0">No nesting of the sequences is supported at the moment, but you can use several ones next to each other: <p class="level0"> <a href="http://any.org/archive">http://any.org/archive</a>[1996-1999]/vol[1-4]/part{a,b,c}.html <p class="level0">You can specify any amount of URLs on the command line. They will be fetched in a sequential manner in the specified order. <p class="level0">Since curl 7.15.1 you can also specify step counter for the ranges, so that you can get every Nth number or letter: <p class="level0"> <a href="http://www.numericals.com/file">http://www.numericals.com/file</a>[1-100:10].txt <a href="http://www.letters.com/file">http://www.letters.com/file</a>[a-z:2].txt <p class="level0">If you specify URL without protocol:// prefix, curl will attempt to guess what protocol you might want. It will then default to HTTP but try other protocols based on often-used host name prefixes. For example, for host names starting with "ftp." curl will assume you want to speak FTP. <p class="level0">Curl will attempt to re-use connections for multiple file transfers, so that getting many files from the same server will not do multiple connects / handshakes. This improves speed. Of course this is only done on files specified on a single command line and cannot be used between separate curl invokes. <a name="PROGRESS"></a><h2 class="nroffsh">PROGRESS METER</h2><p class="level0">curl normally displays a progress meter during operations, indicating amount of transfered data, transfer speeds and estimated time left etc. <p class="level0">However, since curl displays data to the terminal by default, if you invoke curl to do an operation and it is about to write data to the terminal, it <span Class="emphasis">disables</span> the progress meter as otherwise it would mess up the output mixing progress meter and response data. <p class="level0">If you want a progress meter for HTTP POST or PUT requests, you need to redirect the response output to a file, using shell redirect (>), -o [file] or similar. <p class="level0">It is not the same case for FTP upload as that operation is not spitting out any response data to the terminal. <p class="level0">If you prefer a progress "bar" instead of the regular meter, <a class="emphasis" href="#-">-#</a> is your friend. <a name="OPTIONS"></a><h2 class="nroffsh">OPTIONS</h2><p class="level0"><p class="level0"><a name="-a--append"></a><span class="nroffip">-a/--append</span> <p class="level1">(FTP) When used in an FTP upload, this will tell curl to append to the target file instead of overwriting it. If the file doesn't exist, it will be created. <p class="level1">If this option is used twice, the second one will disable append mode again. <p class="level0"><a name="-A--user-agent"></a><span class="nroffip">-A/--user-agent <agent string></span> <p class="level1">(HTTP) Specify the User-Agent string to send to the HTTP server. Some badly done CGIs fail if its not set to "Mozilla/4.0". To encode blanks in the string, surround the string with single quote marks. This can also be set with the <a class="emphasis" href="#-H--header">-H/--header</a> option of course. <p class="level1">If this option is set more than once, the last one will be the one that's used. <p class="level0"><a name="--anyauth"></a><span class="nroffip">--anyauth</span> <p class="level1">(HTTP) Tells curl to figure out authentication method by itself, and use the most secure one the remote site claims it supports. This is done by first doing a request and checking the response-headers, thus inducing an extra network round-trip. This is used instead of setting a specific authentication method, which you can do with <a class="emphasis" href="#--basic">--basic</a>, <a class="emphasis" href="#--digest">--digest</a>, <a class="emphasis" href="#--ntlm">--ntlm</a>, and <a class="emphasis" href="#--negotiate">--negotiate</a>. <p class="level1">Note that using --anyauth is not recommended if you do uploads from stdin, since it may require data to be sent twice and then the client must be able to rewind. If the need should arise when uploading from stdin, the upload operation will fail. <p class="level1">If this option is used several times, the following occurrences make no difference. <p class="level0"><a name="-b--cookie"></a><span class="nroffip">-b/--cookie <name=data></span> <p class="level1">(HTTP) Pass the data to the HTTP server as a cookie. It is supposedly the data previously received from the server in a "Set-Cookie:" line. The data should be in the format "NAME1=VALUE1; NAME2=VALUE2". <p class="level1">If no '=' letter is used in the line, it is treated as a filename to use to read previously stored cookie lines from, which should be used in this session if they match. Using this method also activates the "cookie parser" which will make curl record incoming cookies too, which may be handy if you're using this in combination with the <a class="emphasis" href="#-L--location">-L/--location</a> option. The file format of the file to read cookies from should be plain HTTP headers or the Netscape/Mozilla cookie file format. <p class="level1"><span Class="bold">NOTE</span> that the file specified with <a class="emphasis" href="#-b--cookie">-b/--cookie</a> is only used as input. No cookies will be stored in the file. To store cookies, use the <a class="emphasis" href="#-c--cookie-jar">-c/--cookie-jar</a> option or you could even save the HTTP headers to a file using <a class="emphasis" href="#-D--dump-header">-D/--dump-header</a>! <p class="level1">If this option is set more than once, the last one will be the one that's used. <p class="level0"><a name="-B--use-ascii"></a><span class="nroffip">-B/--use-ascii</span> <p class="level1">Enable ASCII transfer when using FTP or LDAP. For FTP, this can also be enforced by using an URL that ends with ";type=A". This option causes data sent to stdout to be in text mode for win32 systems. <p class="level1">If this option is used twice, the second one will disable ASCII usage. <p class="level0"><a name="--basic"></a><span class="nroffip">--basic</span> <p class="level1">(HTTP) Tells curl to use HTTP Basic authentication. This is the default and this option is usually pointless, unless you use it to override a previously set option that sets a different authentication method (such as <a class="emphasis" href="#--ntlm">--ntlm</a>, <a class="emphasis" href="#--digest">--digest</a> and <a class="emphasis" href="#--negotiate">--negotiate</a>). <p class="level1">If this option is used several times, the following occurrences make no difference. <p class="level0"><a name="--ciphers"></a><span class="nroffip">--ciphers <list of ciphers></span> <p class="level1">(SSL) Specifies which ciphers to use in the connection. The list of ciphers must be using valid ciphers. Read up on SSL cipher list details on this URL: <span Class="emphasis"><a href="http://www.openssl.org/docs/apps/ciphers.html">http://www.openssl.org/docs/apps/ciphers.html</a></span> <p class="level1">If this option is used several times, the last one will override the others. <p class="level0"><a name="--compressed"></a><span class="nroffip">--compressed</span>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -