2016-11-14 06:40:12 +08:00
|
|
|
.\" **************************************************************************
|
|
|
|
.\" * _ _ ____ _
|
|
|
|
.\" * Project ___| | | | _ \| |
|
|
|
|
.\" * / __| | | | |_) | |
|
|
|
|
.\" * | (__| |_| | _ <| |___
|
|
|
|
.\" * \___|\___/|_| \_\_____|
|
|
|
|
.\" *
|
2023-01-02 20:51:48 +08:00
|
|
|
.\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
2016-11-14 06:40:12 +08:00
|
|
|
.\" *
|
|
|
|
.\" * This software is licensed as described in the file COPYING, which
|
|
|
|
.\" * you should have received as part of this distribution. The terms
|
2020-11-04 21:02:01 +08:00
|
|
|
.\" * are also available at https://curl.se/docs/copyright.html.
|
2016-11-14 06:40:12 +08:00
|
|
|
.\" *
|
|
|
|
.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
|
|
.\" * copies of the Software, and permit persons to whom the Software is
|
|
|
|
.\" * furnished to do so, under the terms of the COPYING file.
|
|
|
|
.\" *
|
|
|
|
.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
.\" * KIND, either express or implied.
|
|
|
|
.\" *
|
|
|
|
.\" * SPDX-License-Identifier: curl
|
2022-05-17 17:16:50 +08:00
|
|
|
.\" *
|
2016-11-14 06:40:12 +08:00
|
|
|
.\" **************************************************************************
|
|
|
|
.\"
|
2016-12-16 23:07:59 +08:00
|
|
|
.\" DO NOT EDIT. Generated by the curl project gen.pl man page generator.
|
|
|
|
.\"
|
2021-09-27 22:47:04 +08:00
|
|
|
.TH curl 1 "%DATE" "curl %VERSION" "curl Manual"
|
2016-11-14 06:40:12 +08:00
|
|
|
.SH NAME
|
|
|
|
curl \- transfer a URL
|
|
|
|
.SH SYNOPSIS
|
2018-04-23 14:33:08 +08:00
|
|
|
.B curl [options / URLs]
|
2016-11-14 06:40:12 +08:00
|
|
|
.SH DESCRIPTION
|
2021-11-02 02:14:24 +08:00
|
|
|
**curl** is a tool for transferring data from or to a server. It supports these
|
2021-09-03 05:19:48 +08:00
|
|
|
protocols: DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS,
|
|
|
|
LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP,
|
2022-09-09 21:11:13 +08:00
|
|
|
SMTPS, TELNET, TFTP, WS and WSS. The command is designed to work without user
|
2020-05-13 20:40:05 +08:00
|
|
|
interaction.
|
2016-11-14 06:40:12 +08:00
|
|
|
|
|
|
|
curl offers a busload of useful tricks like proxy support, user
|
|
|
|
authentication, FTP upload, HTTP post, SSL connections, cookies, file transfer
|
2021-06-01 22:24:00 +08:00
|
|
|
resume and more. As you will see below, the number of features will make your
|
2021-12-09 19:03:35 +08:00
|
|
|
head spin.
|
2016-11-14 06:40:12 +08:00
|
|
|
|
|
|
|
curl is powered by libcurl for all transfer-related features. See
|
2021-03-22 23:50:57 +08:00
|
|
|
*libcurl(3)* for details.
|
2016-11-14 06:40:12 +08:00
|
|
|
.SH URL
|
2021-10-31 23:34:44 +08:00
|
|
|
The URL syntax is protocol-dependent. You find a detailed description in
|
2016-11-14 06:40:12 +08:00
|
|
|
RFC 3986.
|
|
|
|
|
|
|
|
You can specify multiple URLs or parts of URLs by writing part sets within
|
2020-03-30 05:51:52 +08:00
|
|
|
braces and quoting the URL as in:
|
2016-11-14 06:40:12 +08:00
|
|
|
|
2020-03-30 05:51:52 +08:00
|
|
|
"http://site.{one,two,three}.com"
|
2016-11-14 06:40:12 +08:00
|
|
|
|
|
|
|
or you can get sequences of alphanumeric series by using [] as in:
|
|
|
|
|
2020-05-14 02:02:44 +08:00
|
|
|
"ftp://ftp.example.com/file[1-100].txt"
|
2016-11-14 06:40:12 +08:00
|
|
|
|
2020-05-14 02:02:44 +08:00
|
|
|
"ftp://ftp.example.com/file[001-100].txt" (with leading zeros)
|
2016-11-14 06:40:12 +08:00
|
|
|
|
2020-05-14 02:02:44 +08:00
|
|
|
"ftp://ftp.example.com/file[a-z].txt"
|
2016-11-14 06:40:12 +08:00
|
|
|
|
|
|
|
Nested sequences are not supported, but you can use several ones next to each
|
|
|
|
other:
|
|
|
|
|
2020-05-14 02:02:44 +08:00
|
|
|
"http://example.com/archive[1996-1999]/vol[1-4]/part{a,b,c}.html"
|
2016-11-14 06:40:12 +08:00
|
|
|
|
|
|
|
You can specify any amount of URLs on the command line. They will be fetched
|
2018-04-23 14:33:08 +08:00
|
|
|
in a sequential manner in the specified order. You can specify command line
|
|
|
|
options and URLs mixed and in any order on the command line.
|
2016-11-14 06:40:12 +08:00
|
|
|
|
|
|
|
You can specify a step counter for the ranges to get every Nth number or
|
|
|
|
letter:
|
|
|
|
|
2020-05-14 02:02:44 +08:00
|
|
|
"http://example.com/file[1-100:10].txt"
|
2016-11-14 06:40:12 +08:00
|
|
|
|
2020-05-14 02:02:44 +08:00
|
|
|
"http://example.com/file[a-z:2].txt"
|
2016-11-14 06:40:12 +08:00
|
|
|
|
|
|
|
When using [] or {} sequences when invoked from a command line prompt, you
|
|
|
|
probably have to put the full URL within double quotes to avoid the shell from
|
|
|
|
interfering with it. This also goes for other characters treated special, like
|
|
|
|
for example '&', '?' and '*'.
|
|
|
|
|
|
|
|
Provide the IPv6 zone index in the URL with an escaped percentage sign and the
|
|
|
|
interface name. Like in
|
|
|
|
|
2020-05-14 02:02:44 +08:00
|
|
|
"http://[fe80::3%25eth0]/"
|
2016-11-14 06:40:12 +08:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
curl will do its best to use what you pass to it as a URL. It is not trying to
|
2021-12-09 19:03:35 +08:00
|
|
|
validate it as a syntactically correct URL by any means but is fairly liberal
|
|
|
|
with what it accepts.
|
2016-11-14 06:40:12 +08:00
|
|
|
|
|
|
|
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
|
2021-07-20 13:06:56 +08:00
|
|
|
invocations.
|
2020-10-27 06:38:52 +08:00
|
|
|
.SH OUTPUT
|
|
|
|
If not told otherwise, curl writes the received data to stdout. It can be
|
|
|
|
instructed to instead save that data into a local file, using the --output or
|
|
|
|
--remote-name options. If curl is given multiple URLs to transfer on the
|
|
|
|
command line, it similarly needs multiple options for where to save them.
|
|
|
|
|
|
|
|
curl does not parse or otherwise "understand" the content it gets or writes as
|
2021-07-20 13:06:56 +08:00
|
|
|
output. It does no encoding or decoding, unless explicitly asked to with
|
2020-10-27 06:38:52 +08:00
|
|
|
dedicated command line options.
|
2020-07-15 23:42:44 +08:00
|
|
|
.SH PROTOCOLS
|
|
|
|
curl supports numerous protocols, or put in URL terms: schemes. Your
|
|
|
|
particular build may not support them all.
|
|
|
|
.IP DICT
|
|
|
|
Lets you lookup words using online dictionaries.
|
|
|
|
.IP FILE
|
|
|
|
Read or write local files. curl does not support accessing file:// URL
|
2020-12-27 12:19:55 +08:00
|
|
|
remotely, but when running on Microsoft Windows using the native UNC approach
|
2020-07-15 23:42:44 +08:00
|
|
|
will work.
|
|
|
|
.IP FTP(S)
|
|
|
|
curl supports the File Transfer Protocol with a lot of tweaks and levers. With
|
|
|
|
or without using TLS.
|
2021-09-03 05:19:48 +08:00
|
|
|
.IP GOPHER(S)
|
2020-07-15 23:42:44 +08:00
|
|
|
Retrieve files.
|
|
|
|
.IP HTTP(S)
|
|
|
|
curl supports HTTP with numerous options and variations. It can speak HTTP
|
|
|
|
version 0.9, 1.0, 1.1, 2 and 3 depending on build options and the correct
|
|
|
|
command line options.
|
|
|
|
.IP IMAP(S)
|
|
|
|
Using the mail reading protocol, curl can "download" emails for you. With or
|
|
|
|
without using TLS.
|
|
|
|
.IP LDAP(S)
|
|
|
|
curl can do directory lookups for you, with or without TLS.
|
|
|
|
.IP MQTT
|
|
|
|
curl supports MQTT version 3. Downloading over MQTT equals "subscribe" to a
|
2021-09-07 05:04:13 +08:00
|
|
|
topic while uploading/posting equals "publish" on a topic. MQTT over TLS is
|
|
|
|
not supported (yet).
|
2020-07-15 23:42:44 +08:00
|
|
|
.IP POP3(S)
|
|
|
|
Downloading from a pop3 server means getting a mail. With or without using
|
|
|
|
TLS.
|
|
|
|
.IP RTMP(S)
|
|
|
|
The Realtime Messaging Protocol is primarily used to server streaming media
|
|
|
|
and curl can download it.
|
|
|
|
.IP RTSP
|
|
|
|
curl supports RTSP 1.0 downloads.
|
|
|
|
.IP SCP
|
|
|
|
curl supports SSH version 2 scp transfers.
|
|
|
|
.IP SFTP
|
|
|
|
curl supports SFTP (draft 5) done over SSH version 2.
|
|
|
|
.IP SMB(S)
|
|
|
|
curl supports SMB version 1 for upload and download.
|
|
|
|
.IP SMTP(S)
|
|
|
|
Uploading contents to an SMTP server means sending an email. With or without
|
|
|
|
TLS.
|
|
|
|
.IP TELNET
|
|
|
|
Telling curl to fetch a telnet URL starts an interactive session where it
|
|
|
|
sends what it reads on stdin and outputs what the server sends it.
|
|
|
|
.IP TFTP
|
|
|
|
curl can do TFTP downloads and uploads.
|
2016-11-14 06:40:12 +08:00
|
|
|
.SH "PROGRESS METER"
|
|
|
|
curl normally displays a progress meter during operations, indicating the
|
|
|
|
amount of transferred data, transfer speeds and estimated time left, etc. The
|
2022-12-10 03:58:13 +08:00
|
|
|
progress meter displays the transfer rate in bytes per second. The suffixes
|
|
|
|
(k, M, G, T, P) are 1024 based. For example 1k is 1024 bytes. 1M is 1048576
|
|
|
|
bytes.
|
2016-11-14 06:40:12 +08:00
|
|
|
|
|
|
|
curl displays this data to the terminal by default, so if you invoke curl to
|
|
|
|
do an operation and it is about to write data to the terminal, it
|
2021-03-22 23:50:57 +08:00
|
|
|
*disables* the progress meter as otherwise it would mess up the output
|
2016-11-14 06:40:12 +08:00
|
|
|
mixing progress meter and response data.
|
|
|
|
|
|
|
|
If you want a progress meter for HTTP POST or PUT requests, you need to
|
2017-01-08 03:21:57 +08:00
|
|
|
redirect the response output to a file, using shell redirect (>), --output or
|
2016-11-14 06:40:12 +08:00
|
|
|
similar.
|
|
|
|
|
2021-07-20 13:06:56 +08:00
|
|
|
This does not apply to FTP upload as that operation does not spit out any
|
|
|
|
response data to the terminal.
|
2016-11-14 06:40:12 +08:00
|
|
|
|
|
|
|
If you prefer a progress "bar" instead of the regular meter, --progress-bar is
|
2017-01-08 03:21:57 +08:00
|
|
|
your friend. You can also disable the progress meter completely with the
|
|
|
|
--silent option.
|
2016-11-14 06:40:12 +08:00
|
|
|
.SH OPTIONS
|
|
|
|
Options start with one or two dashes. Many of the options require an
|
|
|
|
additional value next to them.
|
|
|
|
|
|
|
|
The short "single-dash" form of the options, -d for example, may be used with
|
|
|
|
or without a space between it and its value, although a space is a recommended
|
|
|
|
separator. The long "double-dash" form, --data for example, requires a space
|
|
|
|
between it and its value.
|
|
|
|
|
2021-10-31 23:34:44 +08:00
|
|
|
Short version options that do not need any additional values can be used
|
2016-11-14 06:40:12 +08:00
|
|
|
immediately next to each other, like for example you can specify all the
|
|
|
|
options -O, -L and -v at once as -OLv.
|
|
|
|
|
2021-03-22 23:50:57 +08:00
|
|
|
In general, all boolean options are enabled with --**option** and yet again
|
2021-12-09 19:03:35 +08:00
|
|
|
disabled with --**no-**option. That is, you use the same option name but
|
|
|
|
prefix it with "no-". However, in this list we mostly only list and show the
|
|
|
|
--option version of them.
|
2023-02-21 23:42:26 +08:00
|
|
|
|
|
|
|
When --next is used, it resets the parser state and you start again with a
|
|
|
|
clean option state, except for the options that are "global". Global options
|
|
|
|
will retain their values and meaning even after --next.
|