new
[libcurl.git] / curl.1
blobf93bc0ea0cff3e2a6f6b2ddef76c56271e50822d
1 .\" You can view this file with:
2 .\" nroff -man curl.1
3 .\" Written by Daniel Stenberg
4 .\"
5 .TH curl 1 "8 November 1999" "Curl 6.3" "Curl Manual"
6 .SH NAME
7 curl \- get a URL with FTP, TELNET, LDAP, GOPHER, DICT, FILE, HTTP or
8 HTTPS syntax.
9 .SH SYNOPSIS
10 .B curl [options]
11 .I url
12 .SH DESCRIPTION
13 .B curl
14 is a client to get documents/files from servers, using any of the
15 supported protocols. The command is designed to work without user
16 interaction or any kind of interactivity.
18 curl offers a busload of useful tricks like proxy support, user
19 authentication, ftp upload, HTTP post, SSL (https:) connections, cookies, file
20 transfer resume and more.
21 .SH URL
22 The URL syntax is protocol dependent. You'll find a detailed description in
23 RFC 2396.
25 You can specify multiple URLs or parts of URLs by writing part sets within
26 braces as in:
28  http://site.{one,two,three}.com
30 or you can get sequences of alphanumeric series by using [] as in:
32  ftp://ftp.numericals.com/file[1-100].txt
33  ftp://ftp.numericals.com/file[001-100].txt    (with leading zeros)
34  ftp://ftp.letters.com/file[a-z].txt
36 It is possible to specify up to 9 sets or series for a URL, but no nesting is
37 supported at the moment:
39  http://www.any.org/archive[1996-1999]/volume[1-4]part{a,b,c,index}.html
40 .SH OPTIONS
41 .IP "-a/--append"
42 (FTP)
43 When used in a ftp upload, this will tell curl to append to the target
44 file instead of overwriting it. If the file doesn't exist, it will
45 be created.
46 .IP "-A/--user-agent <agent string>"
47 (HTTP)
48 Specify the User-Agent string to send to the HTTP server. Some badly done CGIs
49 fail if its not set to "Mozilla/4.0".  To encode blanks in the string,
50 surround the string with single quote marks.  This can also be set with the
51 -H/--header flag of course.
52 .IP "-b/--cookie <name=data>"
53 (HTTP)
54 Pass the data to the HTTP server as a cookie. It is supposedly the
55 data previously received from the server in a "Set-Cookie:" line.
56 The data should be in the format "NAME1=VALUE1; NAME2=VALUE2".
58 If no '=' letter is used in the line, it is treated as a filename to use to
59 read previously stored cookie lines from, which should be used in this session
60 if they match. Using this method also activates the "cookie parser" which
61 will make curl record incoming cookies too, which may be handy if you're using
62 this in combination with the -L/--location option. The file format of the file
63 to read cookies from should be plain HTTP headers or the netscape cookie file
64 format.
65 .IP "-B/--ftp-ascii"
66 (FTP/LDAP)
67 Use ASCII transfer when getting an FTP file or LDAP info. For FTP, this can
68 also be enforced by using an URL that ends with ";type=A".
69 .IP "-c/--continue"
70 Continue/Resume a previous file transfer. This instructs curl to
71 continue appending data on the file where it was previously left,
72 possibly because of a broken connection to the server. There must be
73 a named physical file to append to for this to work.
74 Note: Upload resume is depening on a command named SIZE not always
75 present in all ftp servers! Upload resume is for FTP only.
76 HTTP resume is only possible with HTTP/1.1 or later servers.
77 .IP "-C/--continue-at <offset>"
78 Continue/Resume a previous file transfer at the given offset. The
79 given offset is the exact number of bytes that will be skipped
80 counted from the beginning of the source file before it is transfered
81 to the destination.
82 If used with uploads, the ftp server command SIZE will not be used by
83 curl. Upload resume is for FTP only.
84 HTTP resume is only possible with HTTP/1.1 or later servers.
85 .IP "-d/--data <data>"
86 (HTTP)
87 Sends the specified data in a POST request to the HTTP server. Note
88 that the data is sent exactly as specified with no extra processing.
89 The data is expected to be "url-encoded". This will cause curl to
90 pass the data to the server using the content-type
91 application/x-www-form-urlencoded. Compare to -F.
93 If you start the data with the letter @, the rest should be a file name to
94 read the data from, or - if you want curl to read the data from stdin.
95 The contents of the file must already be url-encoded.
96 .IP "-D/--dump-header <file>"
97 (HTTP/FTP)
98 Write the HTTP headers to this file. Write the FTP file info to this
99 file if -I/--head is used.
100 .IP "-e/--referer <URL>"
101 (HTTP)
102 Sends the "Referer Page" information to the HTTP server. Some badly
103 done CGIs fail if it's not set. This can also be set with the -H/--header
104 flag of course.
105 .IP "-E/--cert <certificate[:password]>"
106 (HTTPS)
107 Tells curl to use the specified certificate file when getting a file
108 with HTTPS. The certificate must be in PEM format.
109 If the optional password isn't specified, it will be queried for on
110 the terminal. Note that this certificate is the private key and the private
111 certificate concatenated!
112 .IP "-f/--fail"
113 (HTTP)
114 Fail silently (no output at all) on server errors. This is mostly done
115 like this to better enable scripts etc to better deal with failed
116 attempts. In normal cases when a HTTP server fails to deliver a
117 document, it returns a HTML document stating so (which often also
118 describes why and more). This flag will prevent curl from
119 outputting that and fail silently instead.
120 .IP "-F/--form <name=content>"
121 (HTTP)
122 This lets curl emulate a filled in form in which a user has pressed
123 the submit button. This causes curl to POST data using the
124 content-type multipart/form-data according to RFC1867. This enables
125 uploading of binary files etc. To force the 'content' part to be
126 read from a file, prefix the file name with an @ sign. Example, to
127 send your password file to the server, where 'password' is the
128 name of the form-field to which /etc/passwd will be the input:
130 .B curl
131 -F password=@/etc/passwd www.mypasswords.com
133 To read the file's content from stdin insted of a file, use - where the file
134 name should've been.
135 .IP "-h/--help"
136 Usage help.
137 .IP "-H/--header <header>"
138 (HTTP)
139 Extra header to use when getting a web page. You may specify any number of
140 extra headers. Note that if you should add a custom header that has the same
141 name as one of the internal ones curl would use, your externally set header
142 will be used instead of the internal one. This allows you to make even
143 trickier stuff than curl would normally do. You should not replace internally
144 set headers without knowing perfectly well what you're doing.
145 .IP "-i/--include"
146 (HTTP)
147 Include the HTTP-header in the output. The HTTP-header includes things
148 like server-name, date of the document, HTTP-version and more...
149 .IP "-I/--head"
150 (HTTP/FTP)
151 Fetch the HTTP-header only! HTTP-servers feature the command HEAD
152 which this uses to get nothing but the header of a document. When used
153 on a FTP file, curl displays the file size only.
154 .IP "-K/--config <config file>"
155 Specify which config file to read curl arguments from. The config
156 file is a text file in which command line arguments can be written
157 which then will be used as if they were written on the actual command
158 line. If the first column of a config line is a '#' character, the
159 rest of the line will be treated as a comment.
161 Specify the filename as '-' to make curl read the file from stdin.
162 .IP "-l/--list-only"
163 (FTP)
164 When listing an FTP directory, this switch forces a name-only view.
165 Especially useful if you want to machine-parse the contents of an FTP
166 directory since the normal directory view doesn't use a standard look
167 or format.
168 .IP "-L/--location"
169 (HTTP/HTTPS)
170 If the server reports that the requested page has a different location
171 (indicated with the header line Location:) this flag will let curl
172 attempt to reattempt the get on the new place. If used together with
173 -i or -I, headers from all requested pages will be shown.
174 .IP "-m/--max-time <seconds>"
175 Maximum time in seconds that you allow the whole operation to take.
176 This is useful for preventing your batch jobs from hanging for hours
177 due to slow networks or links going down.
178 This doesn't work properly in win32 systems.
179 .IP "-M/--manual"
180 Manual. Display the huge help text.
181 .IP "-n/--netrc"
182 Makes curl scan the
183 .I .netrc
184 file in the user's home directory for login name and password. This is
185 typically used for ftp on unix. If used with http, curl will enable user
186 authentication. See
187 .BR netrc(4)
188 for details on the file format. Curl will not complain if that file
189 hasn't the right permissions (it should not be world nor group
190 readable). The environment variable "HOME" is used to find the home
191 directory.
193 A quick and very simple example of how to setup a
194 .I .netrc
195 to allow curl to ftp to the machine host.domain.com with user name
196 'myself' and password 'secret' should look similar to:
198 .B "machine host.domain.com user myself password secret"
199 .IP "-o/--output <file>"
200 Write output to <file> instead of stdout. If you are using {} or [] to fetch
201 multiple documents, you can use #<num> in the <file> specifier. That variable
202 will be replaced with the current string for the URL being fetched. Like in:
204   curl http://{one,two}.site.com -o "file_#1.txt"
206 or use several variables like:
208   curl http://{site,host}.host[1-5].com -o "#1_#2"
209 .IP "-O/--remote-name"
210 Write output to a local file named like the remote file we get. (Only
211 the file part of the remote file is used, the path is cut off.)
212 .IP "-P/--ftpport <address>"
213 (FTP)
214 Reverses the initiator/listenor roles when connecting with ftp. This
215 switch makes Curl use the PORT command instead of PASV. In
216 practice, PORT tells the server to connect to the client's specified
217 address and port, while PASV asks the server for an ip address and
218 port to connect to. <address> should be one of:
219  interface - i.e "eth0" to specify which interface's IP address you want to use  (Unix only)
220  IP address - i.e "192.168.10.1" to specify exact IP number
221  host name - i.e "my.host.domain" to specify machine
222  "-"       - (any single-letter string) to make it pick the machine's default
223 .IP "-q"
224 If used as the first parameter on the command line, the
225 .I $HOME/.curlrc
226 file will not be read and used as a config file.
227 .IP "-Q/--quote <comand>"
228 (FTP) Send an arbitrary command to the remote FTP server, by using the QUOTE
229 command of the server. Not all servers support this command, and the set of
230 QUOTE commands are server specific!
231 .IP "-r/--range <range>"
232 (HTTP/FTP)
233 Retrieve a byte range (i.e a partial document) from a HTTP/1.1 or FTP
234 server. Ranges can be specified in a number of ways.
235  0-499           - specifies the first 500 bytes
236  500-999         - specifies the second 500 bytes
237  -500            - specifies the last 500 bytes
238  9500-           - specifies the bytes from offset 9500 and forward
239  0-0,-1          - specifies the first and last byte only(*)(H)
240  500-700,600-799 - specifies 300 bytes from offset 500(H)
241  100-199,500-599 - specifies two separate 100 bytes ranges(*)(H)
243 (*) = NOTE that this will cause the server to reply with a multipart
244 response!
246 You should also be aware that many HTTP/1.1 servers do not have this feature
247 enabled, so that when you attempt to get a range, you'll instead get the whole
248 document.
250 FTP range downloads only support the simple syntax 'start-stop' (optionally
251 with one of the numbers omitted). It depends on the non-RFC command SIZE.
252 .IP "-s/--silent"
253 Silent mode. Don't show progress meter or error messages.  Makes
254 Curl mute.
255 .IP "-S/--show-error"
256 When used with -s it makes curl show error message if it fails.
257 .IP "-t/--upload"
258 Transfer the stdin data to the specified file. Curl will read
259 everything from stdin until EOF and store with the supplied name. If
260 this is used on a http(s) server, the PUT command will be used.
261 .IP "-T/--upload-file <file>"
262 Like -t, but this transfers the specified local file. If there is no
263 file part in the specified URL, Curl will append the local file
264 name. NOTE that you must use a trailing / on the last directory to
265 really prove to Curl that there is no file name or curl will
266 think that your last directory name is the remote file name to
267 use. That will most likely cause the upload operation to fail. If
268 this is used on a http(s) server, the PUT command will be used.
269 .IP "-u/--user <user:password>"
270 Specify user and password to use when fetching. See README.curl for detailed
271 examples of how to use this. If no password is specified, curl will
272 ask for it interactively.
273 .IP "-U/--proxy-user <user:password>"
274 Specify user and password to use for Proxy authentication. If no
275 password is specified, curl will ask for it interactively.
276 .IP "-v/--verbose"
277 Makes the fetching more verbose/talkative. Mostly usable for
278 debugging. Lines starting with '>' means data sent by curl, '<'
279 means data received by curl that is hidden in normal cases and lines
280 starting with '*' means additional info provided by curl.
281 .IP "-V/--version"
282 Displays the full version of curl, libcurl and other 3rd party libraries
283 linked with the executable.
284 .IP "-x/--proxy <proxyhost[:port]>"
285 Use specified proxy. If the port number is not specified, it is assumed at
286 port 1080.
287 .IP "-X/--request <command>"
288 (HTTP)
289 Specifies a custom request to use when communicating with the HTTP server.
290 The specified request will be used instead of the standard GET. Read the
291 HTTP 1.1 specification for details and explanations.
293 (FTP)
294 Specifies a custom FTP command to use instead of LIST when doing file lists
295 with ftp.
296 .IP "-y/--speed-time <speed>"
297 Speed Limit. If a download is slower than this given speed, in bytes
298 per second, for Speed Time seconds it gets aborted. Speed Time is set
299 with -Y and is 30 if not set.
300 .IP "-Y/--speed-limit <time>"
301 Speed Time. If a download is slower than Speed Limit bytes per second
302 during a Speed Time period, the download gets aborted. If Speed Time
303 is used, the default Speed Limit will be 1 unless set with -y.
304 .IP "-z/--time-cond <date expression>"
305 (HTTP)
306 Request to get a file that has been modified later than the given time and
307 date, or one that has been modified before that time. The date expression can
308 be all sorts of date strings or if it doesn't match any internal ones, it
309 tries to get the time from a given file name instead! See the
310 .BR "GNU date(1)"
311 man page for date expression details.
313 Start the date expression with a dash (-) to make it request for a document
314 that is older than the given date/time, default is a document that is newer
315 than the specified date/time.
316 .IP "-3/--sslv3"
317 (HTTPS)
318 Forces curl to use SSL version 3 when negotiating with a remote SSL server.
319 .IP "-2/--sslv2"
320 (HTTPS)
321 Forces curl to use SSL version 2 when negotiating with a remote SSL server.
322 .IP "-#/--progress-bar"
323 Make curl display progress information as a progress bar instead of the
324 default statistics.
325 .IP "--crlf"
326 (FTP) Convert LF to CRLF in upload. Useful for MVS (OS/390).
327 .IP "--stderr <file>"
328 Redirect all writes to stderr to the specified file instead. If the file name
329 is a plain '-', it is instead written to stdout. This option has no point when
330 you're using a shell with decent redirecting capabilities.
331 .SH FILES
332 .I ~/.curlrc
334 Default config file.
336 .SH ENVIRONMENT
337 .IP "HTTP_PROXY [protocol://]<host>[:port]"
338 Sets proxy server to use for HTTP.
339 .IP "HTTPS_PROXY [protocol://]<host>[:port]"
340 Sets proxy server to use for HTTPS.
341 .IP "FTP_PROXY [protocol://]<host>[:port]"
342 Sets proxy server to use for FTP.
343 .IP "GOPHER_PROXY [protocol://]<host>[:port]"
344 Sets proxy server to use for GOPHER.
345 .IP "ALL_PROXY [protocol://]<host>[:port]"
346 Sets proxy server to use if no protocol-specific proxy is set.
347 .IP "NO_PROXY <comma-separated list of hosts>"
348 list of host names that shouldn't go through any proxy. If set to a
349 asterisk '*' only, it matches all hosts.
350 .IP "COLUMNS <integer>"
351 The width of the terminal.  This variable only affects curl when the
352 --progress-bar option is used.
353 .SH DIAGNOSTICS
354 There exists a bunch of different error messages that may appear during
355 bad conditions. They're all pretty verbose and descriptive and therefore
356 you won't find any closer description of them here.
357 .SH BUGS
358 If you do find any (or have other suggestions), mail Daniel Stenberg
359 <Daniel.Stenberg@haxx.nu>.
360 .SH AUTHORS / CONTRIBUTORS
361  - Daniel Stenberg <Daniel.Stenberg@haxx.nu>
362  - Rafael Sagula <sagula@inf.ufrgs.br>
363  - Sampo Kellomaki <sampo@iki.fi>
364  - Linas Vepstas <linas@linas.org>
365  - Bjorn Reese <breese@mail1.stofanet.dk>
366  - Johan Anderson <johan@homemail.com>
367  - Kjell Ericson <Kjell.Ericson@sth.frontec.se>
368  - Troy Engel <tengel@sonic.net>
369  - Ryan Nelson <ryan@inch.com>
370  - Bjorn Stenberg <Bjorn.Stenberg@sth.frontec.se>
371  - Angus Mackay <amackay@gus.ml.org>
372  - Eric Young <eay@cryptsoft.com>
373  - Simon Dick <simond@totally.irrelevant.org>
374  - Oren Tirosh <oren@monty.hishome.net>
375  - Steven G. Johnson <stevenj@alum.mit.edu>
376  - Gilbert Ramirez Jr. <gram@verdict.uthscsa.edu>
377  - Andrés García <ornalux@redestb.es>
378  - Douglas E. Wegscheid <wegscd@whirlpool.com>
379  - Mark Butler <butlerm@xmission.com>
380  - Eric Thelin <eric@generation-i.com>
381  - Marc Boucher <marc@mbsi.ca>
382  - Greg Onufer <Greg.Onufer@Eng.Sun.COM>
383  - Doug Kaufman <dkaufman@rahul.net>
384  - David Eriksson <david@2good.com>
385  - Ralph Beckmann <rabe@uni-paderborn.de>
386  - T. Yamada <tai@imasy.or.jp>
387  - Lars J. Aas <larsa@sim.no>
388  - Jörn Hartroth <Joern.Hartroth@telekom.de>
389  - Matthew Clarke <clamat@van.maves.ca>
390  - Linus Nielsen <Linus.Nielsen@haxx.nu>
391  - Felix von Leitner <felix@convergence.de>
392  - Dan Zitter <dzitter@zitter.net>
393  - Jongki Suwandi <Jongki.Suwandi@eng.sun.com>
394  - Chris Maltby <chris@aurema.com>
395 .SH WWW
396 http://curl.haxx.nu
397 .SH FTP
398 ftp://ftp.sunet.se/pub/www/utilities/curl/
399 .SH "SEE ALSO"
400 .BR ftp (1),
401 .BR wget (1),
402 .BR snarf (1)