Simple 3-step system to complete curl care. Customized for different curl types: Wavy, Curly, Kinky-Coily. Take the DevaCurl curl type quiz and in just a few minutes we can help you find your curl type. No more guesswork! Disrupt Disparities: Challenges & Solutions for 50+ Illinoisans of Color CURL was approached to utilize Loyola’s expertise in a variety of interdisciplinary topics in order to conduct a literature review and analysis of the existing research and data focused on African American/Black, Hispanic/Latino, and Asian American/Pacific Islander older adults in Illinois.
Name
curl - transfer a URLSynopsis
curl [options][URL...]Description
curl is a tool to transfer data from or to a server, using one of the supportedprotocols (HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, DICT, TELNET, LDAP or FILE). The command is designed to work without user interaction.curl offers a busload of useful tricks like proxy support, user authentication, FTP upload, HTTP post, SSL connections, cookies, file transfer resume andmore. As you will see below, the number of features will make your head spin!
curl is powered by libcurl for all transfer-related features. See libcurl(3) for details.
Url
The URL syntax is protocol-dependent. You'll find a detailed description in RFC 3986.You can specify multiple URLs or parts of URLs by writing part sets within braces as in:
http://site.{one,two,three}.com
or you can get sequences of alphanumeric series by using [] as in:
ftp://ftp.numericals.com/file[1-100].txt
ftp://ftp.numericals.com/file[001-100].txt (with leading zeros)
ftp://ftp.letters.com/file[a-z].txt
No nesting of the sequences is supported at the moment, but you can use several ones next to each other:
http://any.org/archive[1996-1999]/vol[1-4]/part{a,b,c}.html
You can specify any amount of URLs on the command line. They will be fetched in a sequential manner in the specified order.
Since curl 7.15.1 you can also specify a step counter for the ranges, so that you can get every Nth number or letter:
http://www.numericals.com/file[1-100:10].txt
http://www.letters.com/file[a-z:2].txt
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 protocolsbased on often-used host name prefixes. For example, for host names starting with 'ftp.' curl will assume you want to speak FTP.
curl will do its best to use what you pass to it as a URL. It is not trying to validate it as a syntactically correct URL by any means but is insteadvery liberal with what it accepts.
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.
Progress Meter
curl normally displays a progress meter during operations, indicating the amount oftransferred data, transfer speeds and estimated time left, etc.However, since curl displays this data to the terminal by default, if you invoke curl to do an operation and it is about to write data to the terminal, itdisables the progress meter as otherwise it would mess up the output mixing progress meter and response data.
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] orsimilar.
It is not the same case for FTP upload as that operation does not spit out any response data to the terminal.
If you prefer a progress 'bar' instead of the regular meter, -# is your friend.
Options
In general, all boolean options are enabled with --option and yet again disabled with--no-option. That is, you use the exact same option name but prefix it with 'no-'. However, in this list we mostly only list and show the --optionversion of them. (This concept with --no options was added in 7.19.0. Previously most options were toggled on/off on repeated use of the same command lineoption.)If this option is set more than once, the last one will be the one that's used.
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 torewind. If the need should arise when uploading from stdin, the upload operation will fail.
If no '=' symbol 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 sessionif 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 thisin combination with the -L/--location option. The file format of the file to read cookies from should be plain HTTP headers or the Netscape/Mozillacookie file format.
NOTE that the file specified with -b/--cookie is only used as input. No cookies will be stored in the file. To store cookies, use the-c/--cookie-jar option or you could even save the HTTP headers to a file using -D/--dump-header!
If this option is set more than once, the last one will be the one that's used.
NSS ciphers are done differently than OpenSSL and GnuTLS. The full list of NSS ciphers is in the NSSCipherSuite entry at this URL:http://directory.fedora.redhat.com/docs/mod_nss.html#Directives
If this option is used several times, the last one will override the others.
If this option is used several times, the last one will be used.
NOTE If the cookie jar can't be created or written to, the whole curl operation won't fail or even report an error clearly. Using -v will get awarning displayed, but that is the only visible feedback you get about this possibly lethal situation.
If this option is used several times, the last specified file name will be used.
Use '-C -' to tell curl to automatically find out where/how to resume the transfer. It then uses the given output/input files to figure that out.
If this option is used several times, the last one will be used.
To create remote directories when using FTP or SFTP, try --ftp-create-dirs.
If this option is used several times, the last one will be used.
(Added in 7.19.7)
-d/--data is the same as --data-ascii. To post data purely binary, you should instead use the --data-binary option. To URL-encode thevalue of a form field you may use --data-urlencode.
If any of these options is used more than once on the same command line, the data pieces specified will be merged together with a separating &-symbol.Thus, using '-d name=daniel -d skill=lousy' would generate a post chunk that looks like 'name=daniel&skill=lousy'.
If you start the data with the letter @, the rest should be a file name to read the data from, or - if you want curl to read the data from stdin. Thecontents of the file must already be URL-encoded. Multiple files can also be specified. Posting data from a file named 'foobar' would thus be done with--data @foobar.
If you start the data with the letter @, the rest should be a filename. Data is posted in a similar manner as --data-ascii does, except that newlinesare preserved and conversions are never done.
If this option is used several times, the ones following the first will append data as described in -d/--data.
To be CGI-compliant, the <data> part should begin with a name followed by a separator and a content specification. The <data> part can bepassed to curl using one of the following syntaxes:
If this option is used several times, the following occurrences make no difference.
Since curl 7.19.0, --eprt can be used to explicitly enable EPRT again and --no-eprt is an alias for --disable-eprt.
Disabling EPRT only changes the active behavior. If you want to switch to passive mode you need to not use -P/--ftp-port or force it with--ftp-pasv.
Since curl 7.19.0, --epsv can be used to explicitly enable EPRT again and --no-epsv is an alias for --disable-epsv.
Disabling EPSV only changes the passive behavior. If you want to switch to active mode you need to use -P/--ftp-port.
This option is handy to use when you want to store the headers that a HTTP site sends to you. Cookies from the headers could then be read in a second curlinvocation by using the -b/--cookie option! The -c/--cookie-jar option is however a better way to store cookies.
When used in FTP, the FTP server response lines are considered being 'headers' and thus are saved there.
If this option is used several times, the last one will be used.
If this option is used several times, the last one will be used.
If curl is built against the NSS SSL library then this option can tell curl the nickname of the certificate to use within the NSS database defined by theenvironment variable SSL_DIR (or by default /etc/pki/nssdb). If the NSS PEM PKCS#11 module (libnsspem.so) is available then PEM files may be loaded. If youwant to use a file from the current directory, please precede it with './' prefix, in order to avoid confusion with a nickname.
If this option is used several times, the last one will be used.
If this option is used several times, the last one will be used.
curl recognizes the environment variable named 'CURL_CA_BUNDLE' if it is set, and uses the given path as a path to a CA cert bundle. This option overridesthat variable.
The windows version of curl will automatically look for a CA certs file named 'curl-ca-bundle.crt', either in the same directory as curl.exe, or in theCurrent Working Directory, or in any folder along your PATH.
If curl is built against the NSS SSL library then this option tells curl the nickname of the CA certificate to use within the NSS database defined by theenvironment variable SSL_DIR (or by default /etc/pki/nssdb). If the NSS PEM PKCS#11 module (libnsspem.so) is available then PEM files may be loaded.
If this option is used several times, the last one will be used.
If this option is used several times, the last one will be used.
This method is not fail-safe and there are occasions where non-successful response codes will slip through, especially when authentication is involved(response codes 401 and 407).
If this option is used twice, the second will override the previous use.
If this option is used several times, the following occurrences make no difference. Undoing an enforced passive really isn't doable but you must theninstead enforce the correct -P/--ftp-port again.
Passive mode means that curl will try the EPSV command first and then PASV, unless --disable-epsv is used.
This option has no effect if PORT, EPRT or EPSV is used instead of PASV.
Example, to send your password file to the server, where 'password' is the name of the form-field to which /etc/passwd will be the input:
curl -F password=@/etc/passwd www.mypasswords.com
To read the file's content from stdin instead of a file, use - where the file name should've been. This goes for both @ and < constructs.
You can also tell curl what Content-Type to use by using 'type=', in a manner similar to:
curl -F 'web=@index.html;type=text/html' url.com
or
curl -F 'name=daniel;type=text/foo'
url.com
You can also explicitly change the name field of an file upload part by setting filename=, like this:
curl -F 'file=@localfile;filename=nameinpost'
url.com
See further examples and details in the MANUAL.
This option can be used multiple times.
If used in combination with -I, the POST data will instead be appended to the URL with a HEAD request.
If this option is used several times, the following occurrences make no difference. This is because undoing a GET doesn't make sense, but you should theninstead enforce the alternative method you prefer.
curl will make sure that each header you add/replace is sent with the proper end-of-line marker, you should thus not add that as a part of the headercontent: do not add newlines or carriage returns, they will only mess things up for you.
See also the -A/--user-agent and -e/--referer options.
This option can be used multiple times to add/replace/remove multiple headers.
curl --interface eth0:1 http://www.netscape.com/
If this option is used several times, the last one will be used.
See this online resource for further details: http://curl.haxx.se/docs/sslcerts.html
If this option is used multiple times, the last occurrence sets the amount.
If this option is used several times, the last one will be used.
If this option is used several times, the last one will be used.
This option requires a library built with kerberos4 or GSSAPI (GSS-Negotiate) support. This is not very common. Use -V/--version to see if your curlsupports it.
If this option is used several times, the last one will be used.
Specify the filename to -K/--config as '-' to make curl read the file from stdin.
Note that to be able to specify a URL in the config file, you need to specify it using the --url option, and not by simply writing the URL on its ownline. So, it could look similar to this:
url = 'http://curl.haxx.se/docs/'
Long option names can optionally be given in the config file without the initial double dashes.
When curl is invoked, it always (unless -q is used) checks for a default config file and uses it if found. The default config file is checked for inthe following places in this order:
1) curl tries to find the 'home dir': It first checks for the CURL_HOME and then the HOME environment variables. Failing that, it uses getpwuid() onUNIX-like systems (which returns the home dir given the current user in your system). On Windows, it then checks for the APPDATA variable, or as a last resortthe '%USERPROFILE%Application Data'.
2) On windows, if there is no _curlrc file in the home dir, it checks for one in the same dir the curl executable is placed. On UNIX-like systems, it willsimply try to load .curlrc from the determined home dir.This option can be used multiple times to load multiple config files.
NOTE: this does not properly support -F and the sending of multipart formposts, so in those cases the output program will be missing necessary calls tocurl_formadd(3), and possibly more.
If this option is used several times, the last given file name will be used. (Added in 7.16.1)
The given speed is measured in bytes/second, unless a suffix is appended. Appending 'k' or 'K' will count the number as kilobytes, 'm' or M' makes itmegabytes, while 'g' or 'G' makes it gigabytes. Examples: 200K, 3m and 1G.
The given rate is the average speed counted during the entire transfer. It means that curl might use higher transfer speeds in short bursts, but over timeit uses no more than the given rate.
If you also use the -Y/--speed-limit option, that option will take precedence and might cripple the rate-limiting slightly, to help keeping thespeed-limit logic working.
If this option is used several times, the last one will be used.
This option causes an FTP NLST command to be sent. Some FTP servers list only files in their response to NLST; they do not include subdirectories andsymbolic links.
When curl follows a redirect and the request is not a plain GET (for example POST or PUT), it will do the following request with a GET if the HTTP responsewas 301, 302, or 303. If the response code was any other 3xx code, curl will re-send the following request using the same unmodified method.
NOTE: The file size is not always known prior to download, and for such files this option has no effect even if the file transfer ends up beinglarger than this given limit. This concerns both FTP and HTTP transfers.
If this option is used several times, the last one will be used.
A quick and very simple example of how to setup a .netrc to allow curl to FTP to the machine host.domain.com with user name 'myself' and password'secret' should look similar to:
machine host.domain.com login myself password secret
If you want to enable Negotiate for your proxy authentication, then use --proxy-negotiate.
This option requires a library built with GSSAPI support. This is not very common. Use -V/--version to see if your version supports GSS-Negotiate.
When using this option, you must also provide a fake -u/--user option to activate the authentication code properly. Sending a '-u :' is enough as the username and password from the -u option aren't actually used.
If this option is used several times, the following occurrences make no difference.
Note that this is the negated option name documented. You can thus use --buffer to enforce the buffering.
Note that this is the negated option name documented. You can thus use --keepalive to enforce keepalive.
Note that this is the negated option name documented. You can thus use --sessionid to enforce session-ID caching.
If you want to enable NTLM for your proxy authentication, then use --proxy-ntlm.
This option requires a library built with SSL support. Use -V/--version to see if your curl supports NTLM.
If this option is used several times, the following occurrences make no difference.
curl http://{one,two}.site.com -o 'file_#1.txt'
or use several variables like:
curl http://{site,host}.host[1-5].com -o '#1_#2'
You may use this option as many times as the number of URLs you have.
See also the --create-dirs option to create the local directories dynamically. Specifying the output as '-' (a single dash) will force the output tobe done to stdout.
The remote file name to use for saving is extracted from the given URL, nothing else.
You may use this option as many times as the number of URLs you have.
Passphrase for the private key
If this option is used several times, the last one will be used.
The only difference between this and the HTTP proxy option (-x/--proxy), is that attempts to use CONNECT through the proxy will specify an HTTP 1.0protocol instead of the default HTTP 1.1.
If this option is used several times, the last one will be used.
If this option is used several times, the last one will be used. Disable the use of PORT with --ftp-pasv. Disable the attempt to use the EPRT commandinstead of PORT by using --disable-eprt. EPRT is really PORT++.
Starting in 7.19.5, you can append ':[start]-[end]' to the right of the address, to tell curl what TCP port range to use. That means you specify a portrange, from a lower to a higher number. A single number works as well, but do note that it increases the risk of failure since the port may not be available.
SFTP is a binary protocol. Unlike for FTP, libcurl interprets SFTP quote commands before sending them to the server. Following is the list of all supportedSFTP quote commands:
(*) = NOTE that this will cause the server to reply with a multipart response!
Only digit characters (0-9) are valid in the 'start' and 'stop' fields of the 'start-stop' range syntax. If a non-digit character is given in the range, theserver's response will be unspecified, depending on the server's configuration.
You should also be aware that many HTTP/1.1 servers do not have this feature enabled, so that when you attempt to get a range, you'll instead get the wholedocument.
FTP and SFTP range downloads only support the simple 'start-stop' syntax (optionally with one of the numbers omitted). FTP use depends on the extended FTPcommand SIZE.
If this option is used several times, the last one will be used.
When curl is about to retry a transfer, it will first wait one second and then for all forthcoming retries it will double the waiting time until it reaches10 minutes which then will be the delay between the rest of the retries. By using --retry-delay you disable this exponential backoff algorithm. See also--retry-max-time to limit the total time allowed for retries. (Added in 7.12.3)
If this option is used multiple times, the last occurrence decide the amount.
If this option is used multiple times, the last occurrence determines the amount.
If this option is used multiple times, the last occurrence determines the amount.
This option overrides any previous use of -x/--proxy, as they are mutually exclusive.
If this option is used several times, the last one will be used.
U Curl Lash Extensions
This option overrides any previous use of -x/--proxy, as they are mutually exclusive.
If this option is used several times, the last one will be used.
This option overrides any previous use of -x/--proxy, as they are mutually exclusive.
If this option is used several times, the last one will be used. (This option was previously wrongly documented and used as --socks without the numberappended.)
This option overrides any previous use of -x/--proxy, as they are mutually exclusive.
If this option is used several times, the last one will be used. (This option was previously wrongly documented and used as --socks without the numberappended.)
This option (as well as --socks4) does not work with IPV6, FTPS or LDAP.
Examples: --socks5 proxy-name --socks5-gssapi-service sockd would use
sockd/proxy-name --socks5 proxy-name --socks5-gssapi-service sockd/real-name would use
sockd/real-name for cases where the proxy-name does not match the princpal name. (Added in 7.19.4).
If this option is used several times, the last one will be used.
TTYPE=<term> Sets the terminal type.
XDISPLOC=<X display> Sets the X display location.
NEW_ENV=<var,val> Sets an environment variable.
Use the file name '-' (a single dash) to use stdin instead of a given file. Alternately, the file name '.' (a single period) may be specified instead of '-'to use stdin in non-blocking mode to allow reading server output while stdin is being uploaded.
You can specify one -T for each URL on the command line. Each -T + URL pair specifies what to upload and to where. curl also supports 'globbing' of the -Targument, meaning that you can upload multiple files to a single URL by using the same URL globbing style supported in the URL, like this:
curl -T '{file1,file2}' http://www.uploadtothissite.com
or even
curl -T 'img[1-1000].png' ftp://ftp.picturemania.com/upload/
This option overrides previous uses of -v/--verbose or --trace-ascii.
If this option is used several times, the last one will be used.
This is very similar to --trace, but leaves out the hex part and only shows the ASCII part of the dump. It makes smaller output that might be easierto read for untrained humans.
This option overrides previous uses of -v/--verbose or --trace.
If this option is used several times, the last one will be used.
If you just give the user name (without entering a colon) curl will prompt for a password.
If you use an SSPI-enabled curl binary and do NTLM authentication, you can force curl to pick up the user name and password from your environment by simplyspecifying a single colon with this option: '-u :'.
If this option is used several times, the last one will be used.
If you use an SSPI-enabled curl binary and do NTLM authentication, you can force curl to pick up the user name and password from your environment by simplyspecifying a single colon with this option: '-U :'.
If this option is used several times, the last one will be used.
This option may be used any number of times. To control where this URL is written, use the -o/--output or the -O/--remote-name options.
Note that if you only want HTTP headers in the output, -i/--include might be the option you're looking for.
If you think this option still doesn't give you enough details, consider using --trace or --trace-ascii instead.
This option overrides previous uses of --trace-ascii or --trace.
Use -s/--silent to make curl quiet.
The first line includes the full version of curl, libcurl and other 3rd party libraries linked with the executable.
The second line (starts with 'Protocols:') shows all protocols that libcurl reports to support.
The third line (starts with 'Features:') shows specific features libcurl reports to offer. Available features include:
The variables present in the output format will be substituted by the value or text that curl thinks fit, as described below. All variables are specified as%{variable_name} and to output a normal % you just write them as %%. You can output a newline by using n, a carriage return with r and a tab space with t.
NOTE: The %-symbol is a special symbol in the win32-environment, where all occurrences of % must be doubled when using this option.
The variables available at this point are:
Curl U Parameter
Ucurl Thin Lizzy
Curl U Command
If this option is used several times, the last one will be used.
This option overrides existing environment variables that set the proxy to use. If there's an environment variable setting a proxy, you can set proxy to 'to override it.
Note that all operations that are performed over a HTTP proxy will transparently be converted to HTTP. It means that certain protocol specificoperations might not be available. This is not the case if you can tunnel through the proxy, as done with the -p/--proxytunnel option.
Starting with 7.14.1, the proxy host can be specified the exact same way as the proxy environment variables, including the protocol prefix (http://) and theembedded user + password.
If this option is used several times, the last one will be used.
(FTP) Specifies a custom FTP command to use instead of LIST when doing file lists with FTP.
If this option is used several times, the last one will be used.
This option controls transfers and thus will not affect slow connects etc. If this is a concern for you, try the --connect-timeout option.
If this option is used several times, the last one will be used.
If this option is used several times, the last one will be used.
Start the date expression with a dash (-) to make it request for a document that is older than the given date/time, default is a document that is newer thanthe specified date/time.
If this option is used several times, the last one will be used.
If this option is used several times, the last one will be used.
Files
~/.curlrcDefault config file, see -K/--config for details.
Environment
The environment variables can be specified in lower case or upper case. The lower case versionhas precedence. http_proxy is an exception as it is only available in lower case.Exit Codes
Curl U Flag
There are a bunch of different error codes and their corresponding error messages that mayappear during bad conditions. At the time of this writing, the exit codes are:- 6
- Couldn't resolve host. The given remote host was not resolved.
- 7
- Failed to connect to host.
- 8
- FTP weird server reply. The server sent data curl couldn't parse.
- 9
- FTP access denied. The server denied login or denied access to the particular resource or directory you wanted to reach. Most often you tried to change toa directory that doesn't exist on the server.
- 11
- FTP weird PASS reply. Curl couldn't parse the reply sent to the PASS request.
- 13
- FTP weird PASV reply, Curl couldn't parse the reply sent to the PASV request.
- 14
- FTP weird 227 format. Curl couldn't parse the 227-line the server sent.
- 15
- FTP can't get host. Couldn't resolve the host IP we got in the 227-line.
- 17
- FTP couldn't set binary. Couldn't change transfer method to binary.
- 18
- Partial file. Only a part of the file was transferred.
- 19
- FTP couldn't download/access the given file, the RETR (or similar) command failed.
- 21
- FTP quote error. A quote command returned error from the server.
- 22
- HTTP page not retrieved. The requested url was not found or returned another error with the HTTP error code being 400 or above. This return code onlyappears if -f/--fail is used.
- 23
- Write error. Curl couldn't write data to a local filesystem or similar.
- 25
- FTP couldn't STOR file. The server denied the STOR operation, used for FTP uploading.
- 26
- Read error. Various reading problems.
- 27
- Out of memory. A memory allocation request failed.
- 28
- Operation timeout. The specified time-out period was reached according to the conditions.
- 30
- FTP PORT failed. The PORT command failed. Not all FTP servers support the PORT command, try doing a transfer using PASV instead!
- 31
- FTP couldn't use REST. The REST command failed. This command is used for resumed FTP transfers.
- 33
- HTTP range error. The range 'command' didn't work.
- 34
- HTTP post error. Internal post-request generation error.
- 35
- SSL connect error. The SSL handshaking failed.
- 36
- FTP bad download resume. Couldn't continue an earlier aborted download.
- 37
- FILE couldn't read file. Failed to open the file. Permissions?
- 38
- LDAP cannot bind. LDAP bind operation failed.
- 39
- LDAP search failed.
- 41
- Function not found. A required LDAP function was not found.
- 42
- Aborted by callback. An application told curl to abort the operation.
- 43
- Internal error. A function was called with a bad parameter.
- 45
- Interface error. A specified outgoing interface could not be used.
- 47
- Too many redirects. When following redirects, curl hit the maximum amount.
- 48
- Unknown TELNET option specified.
- 49
- Malformed telnet option.
- 51
- The peer's SSL certificate or SSH MD5 fingerprint was not ok.
- 52
- The server didn't reply anything, which here is considered an error.
- 53
- SSL crypto engine not found.
- 54
- Cannot set SSL crypto engine as default.
- 55
- Failed sending network data.
- 56
- Failure in receiving network data.
- 58
- Problem with the local certificate.
- 59
- Couldn't use specified SSL cipher.
- 60
- Peer certificate cannot be authenticated with known CA certificates.
- 61
- Unrecognized transfer encoding.
- 62
- Invalid LDAP URL.
- 63
- Maximum file size exceeded.
- 64
- Requested FTP SSL level failed.
- 65
- Sending the data requires a rewind that failed.
- 66
- Failed to initialise SSL Engine.
- 67
- The user name, password, or similar was not accepted and curl failed to log in.
- 68
- File not found on TFTP server.
- 69
- Permission problem on TFTP server.
- 70
- Out of disk space on TFTP server.
- 71
- Illegal TFTP operation.
- 72
- Unknown TFTP transfer ID.
- 73
- File already exists (TFTP).
- 74
- No such user (TFTP).
- 75
- Character conversion failed.
- 76
- Character conversion functions required.
- 77
- Problem with reading the SSL CA cert (path? access rights?).
- 78
- The resource referenced in the URL does not exist.
- 79
- An unspecified error occurred during the SSH session.
- 80
- Failed to shut down the SSL connection.
- 82
- Could not load CRL file, missing or wrong format (added in 7.19.0).
- 83
- Issuer check failed (added in 7.19.0).
- XX
- More error codes will appear here in future releases. The existing ones are meant to never change.