cURL - How To Use
cURL - How To Use
curl.1themanpage
NAME Related:
Manual
curltransferaURL FAQ
HTTPScripting
SYNOPSIS
curl[options][URL...]
DESCRIPTION
curlisatooltotransferdatafromortoaserver,usingoneofthesupportedprotocols
(DICT,FILE,FTP,FTPS,GOPHER,HTTP,HTTPS,IMAP,IMAPS,LDAP,LDAPS,POP3,
POP3S,RTMP,RTSP,SCP,SFTP,SMB,SMBS,SMTP,SMTPS,TELNETandTFTP).
Thecommandisdesignedtoworkwithoutuserinteraction.
curloffersabusloadofusefultrickslikeproxysupport,userauthentication,FTPupload,
HTTPpost,SSLconnections,cookies,filetransferresume,Metalink,andmore.Asyou
willseebelow,thenumberoffeatureswillmakeyourheadspin!
curlispoweredbylibcurlforalltransferrelatedfeatures.Seelibcurl(3)fordetails.
URL
TheURLsyntaxisprotocoldependent.You'llfindadetaileddescriptioninRFC3986.
YoucanspecifymultipleURLsorpartsofURLsbywritingpartsetswithinbracesasin:
http://site.{one,two,three}.com
oryoucangetsequencesofalphanumericseriesbyusing[]asin:
ftp://ftp.example.com/file[1100].txt
ftp://ftp.example.com/file[001100].txt(withleadingzeros)
ftp://ftp.example.com/file[az].txt
Nestedsequencesarenotsupported,butyoucanuseseveralonesnexttoeachother:
http://example.com/archive[19961999]/vol[14]/part{a,b,c}.html
https://curl.haxx.se/docs/manpage.html 1/51
28/04/2016 cURLHowToUse
YoucanspecifyanyamountofURLsonthecommandline.Theywillbefetchedina
sequentialmannerinthespecifiedorder.
YoucanspecifyastepcounterfortherangestogeteveryNthnumberorletter:
http://example.com/file[1100:10].txt
http://example.com/file[az:2].txt
Whenusing[]or{}sequenceswheninvokedfromacommandlineprompt,youprobably
havetoputthefullURLwithindoublequotestoavoidtheshellfrominterferingwithit.This
alsogoesforothercharacterstreatedspecial,likeforexample'&','?'and'*'.
ProvidetheIPv6zoneindexintheURLwithanescapedpercentagesignandthe
interfacename.Likein
http://[fe80::3%25eth0]/
IfyouspecifyURLwithoutprotocol://prefix,curlwillattempttoguesswhatprotocolyou
mightwant.ItwillthendefaulttoHTTPbuttryotherprotocolsbasedonoftenusedhost
nameprefixes.Forexample,forhostnamesstartingwith"ftp."curlwillassumeyouwant
tospeakFTP.
curlwilldoitsbesttousewhatyoupasstoitasaURL.Itisnottryingtovalidateitasa
syntacticallycorrectURLbyanymeansbutisinsteadveryliberalwithwhatitaccepts.
curlwillattempttoreuseconnectionsformultiplefiletransfers,sothatgettingmanyfiles
fromthesameserverwillnotdomultipleconnects/handshakes.Thisimprovesspeed.Of
coursethisisonlydoneonfilesspecifiedonasinglecommandlineandcannotbeused
betweenseparatecurlinvokes.
PROGRESSMETER
curlnormallydisplaysaprogressmeterduringoperations,indicatingtheamountof
transferreddata,transferspeedsandestimatedtimeleft,etc.
curldisplaysthisdatatotheterminalbydefault,soifyouinvokecurltodoanoperation
anditisabouttowritedatatotheterminal,itdisablestheprogressmeterasotherwiseit
wouldmessuptheoutputmixingprogressmeterandresponsedata.
IfyouwantaprogressmeterforHTTPPOSTorPUTrequests,youneedtoredirectthe
responseoutputtoafile,usingshellredirect(>),o[file]orsimilar.
ItisnotthesamecaseforFTPuploadasthatoperationdoesnotspitoutanyresponse
datatotheterminal.
Ifyoupreferaprogress"bar"insteadoftheregularmeter,#isyourfriend.
OPTIONS
Optionsstartwithoneortwodashes.Manyoftheoptionsrequireanadditionalvaluenext
tothem.
Theshort"singledash"formoftheoptions,dforexample,maybeusedwithorwithouta
https://curl.haxx.se/docs/manpage.html 2/51
28/04/2016 cURLHowToUse
spacebetweenitanditsvalue,althoughaspaceisarecommendedseparator.Thelong
"doubledash"form,dataforexample,requiresaspacebetweenitanditsvalue.
Shortversionoptionsthatdon'tneedanyadditionalvaluescanbeusedimmediatelynext
toeachother,likeforexampleyoucanspecifyalltheoptionsO,Landvatonceas
OLv.
Ingeneral,allbooleanoptionsareenabledwithoptionandyetagaindisabledwithno
option.Thatis,youusetheexactsameoptionnamebutprefixitwith"no".However,in
thislistwemostlyonlylistandshowtheoptionversionofthem.(Thisconceptwithno
optionswasaddedin7.19.0.Previouslymostoptionsweretoggledon/offonrepeateduse
ofthesamecommandlineoption.)
#,progressbar
Makecurldisplayprogressasasimpleprogressbarinsteadofthestandard,more
informational,meter.
:,next
TellscurltouseaseparateoperationforthefollowingURLandassociatedoptions.
ThisallowsyoutosendseveralURLrequests,eachwiththeirownspecificoptions,
forexample,suchasdifferentusernamesorcustomrequestsforeach.(Addedin
7.36.0)
0,http1.0
(HTTP)TellscurltouseHTTPversion1.0insteadofusingitsinternallypreferred:
HTTP1.1.
http1.1
(HTTP)TellscurltouseHTTPversion1.1.Thisistheinternaldefaultversion.(Added
in7.33.0)
http2
(HTTP)TellscurltoissueitsrequestsusingHTTP2.Thisrequiresthattheunderlying
libcurlwasbuilttosupportit.(Addedin7.33.0)
http2priorknowledge
(HTTP)TellscurltoissueitsnonTLSHTTPrequestsusingHTTP/2without
HTTP/1.1Upgrade.ItrequirespriorknowledgethattheserversupportsHTTP/2
straightaway.HTTPSrequestswillstilldoHTTP/2thestandardwaywithnegotiated
protocolversionintheTLShandshake.
HTTP/2supportingeneralalsorequiresthattheunderlyinglibcurlwasbuilttosupport
it.(Addedin7.49.0)
nonpn
DisabletheNPNTLSextension.NPNisenabledbydefaultiflibcurlwasbuiltwithan
SSLlibrarythatsupportsNPN.NPNisusedbyalibcurlthatsupportsHTTP2to
negotiateHTTP2supportwiththeserverduringhttpssessions.
https://curl.haxx.se/docs/manpage.html 3/51
28/04/2016 cURLHowToUse
(Addedin7.36.0)
noalpn
DisabletheALPNTLSextension.ALPNisenabledbydefaultiflibcurlwasbuiltwith
anSSLlibrarythatsupportsALPN.ALPNisusedbyalibcurlthatsupportsHTTP2to
negotiateHTTP2supportwiththeserverduringhttpssessions.
(Addedin7.36.0)
1,tlsv1
(SSL)ForcescurltouseTLSversion1.xwhennegotiatingwitharemoteTLSserver.
Youcanuseoptionstlsv1.0,tlsv1.1,andtlsv1.2tocontroltheTLSversionmore
precisely(iftheSSLbackendinusesupportssuchalevelofcontrol).
2,sslv2
(SSL)ForcescurltouseSSLversion2whennegotiatingwitharemoteSSLserver.
SometimescurlisbuiltwithoutSSLv2support.SSLv2iswidelyconsideredinsecure
(seeRFC6176).
3,sslv3
(SSL)ForcescurltouseSSLversion3whennegotiatingwitharemoteSSLserver.
SometimescurlisbuiltwithoutSSLv3support.SSLv3iswidelyconsideredinsecure
(seeRFC7568).
4,ipv4
ThisoptiontellscurltoresolvenamestoIPv4addressesonly,andnotforexampletry
IPv6.
6,ipv6
ThisoptiontellscurltoresolvenamestoIPv6addressesonly,andnotforexampletry
IPv4.
a,append
(FTP/SFTP)Whenusedinanupload,thismakescurlappendtothetargetfileinstead
ofoverwritingit.Iftheremotefiledoesn'texist,itwillbecreated.Notethatthisflagis
ignoredbysomeSFTPservers(includingOpenSSH).
A,useragent<agentstring>
(HTTP)SpecifytheUserAgentstringtosendtotheHTTPserver.Somebadlydone
CGIsfailifthisfieldisn'tsetto"Mozilla/4.0".Toencodeblanksinthestring,surround
thestringwithsinglequotemarks.ThiscanalsobesetwiththeH,headeroptionof
course.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
anyauth
(HTTP)Tellscurltofigureoutauthenticationmethodbyitself,andusethemost
https://curl.haxx.se/docs/manpage.html 4/51
28/04/2016 cURLHowToUse
secureonetheremotesiteclaimstosupport.Thisisdonebyfirstdoingarequestand
checkingtheresponseheaders,thuspossiblyinducinganextranetworkroundtrip.
Thisisusedinsteadofsettingaspecificauthenticationmethod,whichyoucando
withbasic,digest,ntlm,andnegotiate.
Notethatusinganyauthisnotrecommendedifyoudouploadsfromstdin,sinceit
mayrequiredatatobesenttwiceandthentheclientmustbeabletorewind.Ifthe
needshouldarisewhenuploadingfromstdin,theuploadoperationwillfail.
b,cookie<name=data>
(HTTP)PassthedatatotheHTTPserverasacookie.Itissupposedlythedata
previouslyreceivedfromtheserverina"SetCookie:"line.Thedatashouldbeinthe
format"NAME1=VALUE1NAME2=VALUE2".
Ifno'='symbolisusedintheline,itistreatedasafilenametousetoreadpreviously
storedcookielinesfrom,whichshouldbeusedinthissessioniftheymatch.Using
thismethodalsoactivatesthecookieenginewhichwillmakecurlrecordincoming
cookiestoo,whichmaybehandyifyou'reusingthisincombinationwiththeL,
locationoption.ThefileformatofthefiletoreadcookiesfromshouldbeplainHTTP
headers(SetCookiestyle)ortheNetscape/Mozillacookiefileformat.
Thefilespecifiedwithb,cookieisonlyusedasinput.Nocookieswillbewrittento
thefile.Tostorecookies,usethec,cookiejaroption.
Exercisecautionifyouareusingthisoptionandmultipletransfersmayoccur.Ifyou
usetheNAME1=VALUE1format,orinafileusetheSetCookieformatanddon't
specifyadomain,thenthecookieissentforanydomain(evenafterredirectsare
followed)andcannotbemodifiedbyaserversetcookie.Ifthecookieengineis
enabledandaserversetsacookieofthesamenamethenbothwillbesentona
futuretransfertothatserver,likelynotwhatyouintended.Toaddresstheseissues
setadomaininSetCookie(doingthatwillincludesubdomains)orusetheNetscape
format.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
B,useascii
(FTP/LDAP)EnableASCIItransfer.ForFTP,thiscanalsobeenforcedbyusingan
URLthatendswith"type=A".Thisoptioncausesdatasenttostdouttobeintext
modeforwin32systems.
basic
(HTTP)TellscurltouseHTTPBasicauthenticationwiththeremotehost.Thisisthe
defaultandthisoptionisusuallypointless,unlessyouuseittooverrideapreviously
setoptionthatsetsadifferentauthenticationmethod(suchasntlm,digest,or
negotiate).
Usedtogetherwithu,userandx,proxy.
Seealsoproxybasic.
c,cookiejar<filename>
(HTTP)Specifytowhichfileyouwantcurltowriteallcookiesafteracompleted
https://curl.haxx.se/docs/manpage.html 5/51
28/04/2016 cURLHowToUse
operation.Curlwritesallcookiespreviouslyreadfromaspecifiedfileaswellasall
cookiesreceivedfromremoteserver(s).Ifnocookiesareknown,nodatawillbe
written.ThefilewillbewrittenusingtheNetscapecookiefileformat.Ifyousetthefile
nametoasingledash,"",thecookieswillbewrittentostdout.
Thiscommandlineoptionwillactivatethecookieenginethatmakescurlrecordand
usecookies.Anotherwaytoactivateitistousetheb,cookieoption.
Ifthecookiejarcan'tbecreatedorwrittento,thewholecurloperationwon'tfailor
evenreportanerrorclearly.Usingvwillgetawarningdisplayed,butthatistheonly
visiblefeedbackyougetaboutthispossiblylethalsituation.
Since7.43.0cookiesthatwereimportedintheSetCookieformatwithoutadomain
namearenotexportedbythisoption.
Ifthisoptionisusedseveraltimes,thelastspecifiedfilenamewillbeused.
C,continueat<offset>
Continue/Resumeapreviousfiletransferatthegivenoffset.Thegivenoffsetisthe
exactnumberofbytesthatwillbeskipped,countingfromthebeginningofthesource
filebeforeitistransferredtothedestination.Ifusedwithuploads,theFTPserver
commandSIZEwillnotbeusedbycurl.
Use"C"totellcurltoautomaticallyfindoutwhere/howtoresumethetransfer.It
thenusesthegivenoutput/inputfilestofigurethatout.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
ciphers<listofciphers>
(SSL)Specifieswhichcipherstouseintheconnection.Thelistofciphersmust
specifyvalidciphers.ReaduponSSLcipherlistdetailsonthisURL:
https://www.openssl.org/docs/apps/ciphers.html
NSSciphersaredonedifferentlythanOpenSSLandGnuTLS.ThefulllistofNSS
ciphersisintheNSSCipherSuiteentryatthisURL:
https://git.fedorahosted.org/cgit/mod_nss.git/plain/docs/mod_nss.html#Directives
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
compressed
(HTTP)Requestacompressedresponseusingoneofthealgorithmscurlsupports,
andsavetheuncompresseddocument.Ifthisoptionisusedandtheserversendsan
unsupportedencoding,curlwillreportanerror.
connecttimeout<seconds>
Maximumtimeinsecondsthatyouallowcurl'sconnectiontotake.Thisonlylimitsthe
connectionphase,soifcurlconnectswithinthegivenperioditwillcontinueifnotit
willexit.Sinceversion7.32.0,thisoptionacceptsdecimalvalues.
Seealsothem,maxtimeoption.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
https://curl.haxx.se/docs/manpage.html 6/51
28/04/2016 cURLHowToUse
createdirs
Whenusedinconjunctionwiththeooption,curlwillcreatethenecessarylocal
directoryhierarchyasneeded.Thisoptioncreatesthedirsmentionedwiththeo
option,nothingelse.Iftheofilenameusesnodirorifthedirsitmentionsalready
exist,nodirwillbecreated.
TocreateremotedirectorieswhenusingFTPorSFTP,tryftpcreatedirs.
crlf
ConvertLFtoCRLFinupload.UsefulforMVS(OS/390).
(SMTPaddedin7.40.0)
crlfile<file>
(HTTPS/FTPS)ProvideafileusingPEMformatwithaCertificateRevocationListthat
mayspecifypeercertificatesthataretobeconsideredrevoked.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
(Addedin7.19.7)
d,data<data>
(HTTP)SendsthespecifieddatainaPOSTrequesttotheHTTPserver,inthesame
waythatabrowserdoeswhenauserhasfilledinanHTMLformandpressesthe
submitbutton.Thiswillcausecurltopassthedatatotheserverusingthecontent
typeapplication/xwwwformurlencoded.ComparetoF,form.
d,dataisthesameasdataascii.datarawisalmostthesamebutdoesnothave
[email protected],youshould
insteadusethedatabinaryoption.ToURLencodethevalueofaformfieldyou
mayusedataurlencode.
Ifanyoftheseoptionsisusedmorethanonceonthesamecommandline,thedata
piecesspecifiedwillbemergedtogetherwithaseparating&symbol.Thus,using'd
name=danieldskill=lousy'wouldgenerateapostchunkthatlookslike
'name=daniel&skill=lousy'.
Ifyoustartthedatawiththeletter@,therestshouldbeafilenametoreadthedata
from,orifyouwantcurltoreadthedatafromstdin.Multiplefilescanalsobe
specified.Postingdatafromafilenamed'foobar'wouldthusbedonewithdata
@foobar.Whendataistoldtoreadfromafilelikethat,carriagereturnsand
newlineswillbestrippedout.Ifyoudon'twantthe@charactertohaveaspecial
interpretationusedatarawinstead.
D,dumpheader<file>
Writetheprotocolheaderstothespecifiedfile.
ThisoptionishandytousewhenyouwanttostoretheheadersthatanHTTPsite
sendstoyou.Cookiesfromtheheaderscouldthenbereadinasecondcurl
invocationbyusingtheb,cookieoption!Thec,cookiejaroptionisabetterway
tostorecookies.
https://curl.haxx.se/docs/manpage.html 7/51
28/04/2016 cURLHowToUse
WhenusedinFTP,theFTPserverresponselinesareconsideredbeing"headers"
andthusaresavedthere.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
dataascii<data>
Seed,data.
databinary<data>
(HTTP)Thispostsdataexactlyasspecifiedwithnoextraprocessingwhatsoever.
Ifyoustartthedatawiththeletter@,therestshouldbeafilename.Dataispostedin
asimilarmannerasdataasciidoes,exceptthatnewlinesandcarriagereturnsare
preservedandconversionsareneverdone.
Ifthisoptionisusedseveraltimes,theonesfollowingthefirstwillappenddataas
describedind,data.
dataraw<data>
(HTTP)Thispostsdatasimilarlytodatabutwithoutthespecialinterpretationofthe
@character.Seed,data.(Addedin7.43.0)
dataurlencode<data>
(HTTP)Thispostsdata,similartotheotherdataoptionswiththeexceptionthatthis
performsURLencoding.(Addedin7.18.0)
TobeCGIcompliant,the<data>partshouldbeginwithanamefollowedbya
separatorandacontentspecification.The<data>partcanbepassedtocurlusing
oneofthefollowingsyntaxes:
content
ThiswillmakecurlURLencodethecontentandpassthaton.Justbecarefulso
thatthecontentdoesn'tcontainany=or@symbols,asthatwillthenmakethe
syntaxmatchoneoftheothercasesbelow!
=content
ThiswillmakecurlURLencodethecontentandpassthaton.Thepreceding=
symbolisnotincludedinthedata.
name=content
ThiswillmakecurlURLencodethecontentpartandpassthaton.Notethatthe
namepartisexpectedtobeURLencodedalready.
@filename
Thiswillmakecurlloaddatafromthegivenfile(includinganynewlines),URL
encodethatdataandpassitoninthePOST.
name@filename
https://curl.haxx.se/docs/manpage.html 8/51
28/04/2016 cURLHowToUse
Thiswillmakecurlloaddatafromthegivenfile(includinganynewlines),URL
encodethatdataandpassitoninthePOST.Thenamepartgetsanequalsign
appended,resultinginname=urlencodedfilecontent.Notethatthenameis
expectedtobeURLencodedalready.
delegationLEVEL
SetLEVELtotelltheserverwhatitisallowedtodelegatewhenitcomestouser
credentials.UsedwithGSS/kerberos.
none
Don'tallowanydelegation.
policy
DelegatesifandonlyiftheOKASDELEGATEflagissetintheKerberosservice
ticket,whichisamatterofrealmpolicy.
always
Unconditionallyallowtheservertodelegate.
digest
(HTTP)EnablesHTTPDigestauthentication.Thisisanauthenticationschemethat
preventsthepasswordfrombeingsentoverthewireincleartext.Usethisin
combinationwiththenormalu,useroptiontosetusernameandpassword.See
alsontlm,negotiateandanyauthforrelatedoptions.
Ifthisoptionisusedseveraltimes,onlythefirstoneisused.
disableeprt
(FTP)TellcurltodisabletheuseoftheEPRTandLPRTcommandswhendoing
activeFTPtransfers.CurlwillnormallyalwaysfirstattempttouseEPRT,thenLPRT
beforeusingPORT,butwiththisoption,itwillusePORTrightaway.EPRTandLPRT
areextensionstotheoriginalFTPprotocol,andmaynotworkonallservers,butthey
enablemorefunctionalityinabetterwaythanthetraditionalPORTcommand.
eprtcanbeusedtoexplicitlyenableEPRTagainandnoeprtisanaliasfor
disableeprt.
IftheserverisanIPv6host,thisoptionwillhavenoeffectasEPRTisnecessary
then.
DisablingEPRTonlychangestheactivebehavior.Ifyouwanttoswitchtopassive
modeyouneedtonotuseP,ftpportorforceitwithftppasv.
disableepsv
(FTP)TellcurltodisabletheuseoftheEPSVcommandwhendoingpassiveFTP
transfers.CurlwillnormallyalwaysfirstattempttouseEPSVbeforePASV,butwith
thisoption,itwillnottryusingEPSV.
epsvcanbeusedtoexplicitlyenableEPSVagainandnoepsvisanaliasfor
https://curl.haxx.se/docs/manpage.html 9/51
28/04/2016 cURLHowToUse
disableepsv.
IftheserverisanIPv6host,thisoptionwillhavenoeffectasEPSVisnecessary
then.
DisablingEPSVonlychangesthepassivebehavior.Ifyouwanttoswitchtoactive
modeyouneedtouseP,ftpport.
dnsinterface<interface>
TellcurltosendoutgoingDNSrequeststhrough<interface>.Thisoptionisa
counterparttointerface(whichdoesnotaffectDNS).Thesuppliedstringmustbean
interfacename(notanaddress).
Thisoptionrequiresthatlibcurlwasbuiltwitharesolverbackendthatsupportsthis
operation.Thecaresbackendistheonlysuchone.(Addedin7.33.0)
dnsipv4addr<ipaddress>
Tellcurltobindto<ipaddress>whenmakingIPv4DNSrequests,sothattheDNS
requestsoriginatefromthisaddress.TheargumentshouldbeasingleIPv4address.
Thisoptionrequiresthatlibcurlwasbuiltwitharesolverbackendthatsupportsthis
operation.Thecaresbackendistheonlysuchone.(Addedin7.33.0)
dnsipv6addr<ipaddress>
Tellcurltobindto<ipaddress>whenmakingIPv6DNSrequests,sothattheDNS
requestsoriginatefromthisaddress.TheargumentshouldbeasingleIPv6address.
Thisoptionrequiresthatlibcurlwasbuiltwitharesolverbackendthatsupportsthis
operation.Thecaresbackendistheonlysuchone.(Addedin7.33.0)
dnsservers<ipaddress,ipaddress>
SetthelistofDNSserverstobeusedinsteadofthesystemdefault.ThelistofIP
addressesshouldbeseparatedwithcommas.Portnumbersmayalsooptionallybe
givenas:<portnumber>aftereachIPaddress.
Thisoptionrequiresthatlibcurlwasbuiltwitharesolverbackendthatsupportsthis
operation.Thecaresbackendistheonlysuchone.(Addedin7.33.0)
e,referer<URL>
(HTTP)Sendsthe"ReferrerPage"informationtotheHTTPserver.Thiscanalsobe
setwiththeH,headerflagofcourse.WhenusedwithL,locationyoucanappend
"auto"totherefererURLtomakecurlautomaticallysetthepreviousURLwhenit
followsaLocation:header.The"auto"stringcanbeusedalone,evenifyoudon'tset
aninitialreferer.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
E,cert<certificate[:password]>
(SSL)Tellscurltousethespecifiedclientcertificatefilewhengettingafilewith
HTTPS,FTPSoranotherSSLbasedprotocol.ThecertificatemustbeinPKCS#12
https://curl.haxx.se/docs/manpage.html 10/51
28/04/2016 cURLHowToUse
formatifusingSecureTransport,orPEMformatifusinganyotherengine.Ifthe
optionalpasswordisn'tspecified,itwillbequeriedforontheterminal.Notethatthis
optionassumesa"certificate"filethatistheprivatekeyandtheclientcertificate
concatenated!Seecertandkeytospecifythemindependently.
IfcurlisbuiltagainsttheNSSSSLlibrarythenthisoptioncantellcurlthenicknameof
thecertificatetousewithintheNSSdatabasedefinedbytheenvironmentvariable
SSL_DIR(orbydefault/etc/pki/nssdb).IftheNSSPEMPKCS#11module
(libnsspem.so)isavailablethenPEMfilesmaybeloaded.Ifyouwanttouseafile
fromthecurrentdirectory,pleaseprecedeitwith"./"prefix,inordertoavoidconfusion
withanickname.Ifthenicknamecontains":",itneedstobeprecededby"\"sothatit
isnotrecognizedaspassworddelimiter.Ifthenicknamecontains"\",itneedstobe
escapedas"\\"sothatitisnotrecognizedasanescapecharacter.
(iOSandMacOSXonly)IfcurlisbuiltagainstSecureTransport,thenthecertificate
stringcaneitherbethenameofacertificate/privatekeyinthesystemoruser
keychain,orthepathtoaPKCS#12encodedcertificateandprivatekey.Ifyouwant
touseafilefromthecurrentdirectory,pleaseprecedeitwith"./"prefix,inorderto
avoidconfusionwithanickname.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
engine<name>
SelecttheOpenSSLcryptoenginetouseforcipheroperations.Useenginelistto
printalistofbuildtimesupportedengines.Notethatnotall(ornone)oftheengines
maybeavailableatruntime.
environment
(RISCOSONLY)Setsarangeofenvironmentvariables,usingthenamesthew
optionsupports,toalloweasierextractionofusefulinformationafterhavingruncurl.
egdfile<file>
(SSL)SpecifythepathnametotheEntropyGatheringDaemonsocket.Thesocketis
usedtoseedtherandomengineforSSLconnections.Seealsotherandomfile
option.
expect100timeout<seconds>
(HTTP)Maximumtimeinsecondsthatyouallowcurltowaitfora100continue
responsewhencurlemitsanExpects:100continueheaderinitsrequest.Bydefault
curlwillwaitonesecond.Thisoptionacceptsdecimalvalues!Whencurlstops
waiting,itwillcontinueasiftheresponsehasbeenreceived.
(Addedin7.47.0)
certtype<type>
(SSL)Tellscurlwhatcertificatetypetheprovidedcertificateisin.PEM,DERand
ENGarerecognizedtypes.Ifnotspecified,PEMisassumed.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
cacert<CAcertificate>
https://curl.haxx.se/docs/manpage.html 11/51
28/04/2016 cURLHowToUse
(SSL)Tellscurltousethespecifiedcertificatefiletoverifythepeer.Thefilemay
containmultipleCAcertificates.Thecertificate(s)mustbeinPEMformat.Normally
curlisbuilttouseadefaultfileforthis,sothisoptionistypicallyusedtoalterthat
defaultfile.
curlrecognizestheenvironmentvariablenamed'CURL_CA_BUNDLE'ifitisset,and
usesthegivenpathasapathtoaCAcertbundle.Thisoptionoverridesthatvariable.
ThewindowsversionofcurlwillautomaticallylookforaCAcertsfilenamedcurlca
bundle.crt,eitherinthesamedirectoryascurl.exe,orintheCurrentWorking
Directory,orinanyfolderalongyourPATH.
IfcurlisbuiltagainsttheNSSSSLlibrary,theNSSPEMPKCS#11module
(libnsspem.so)needstobeavailableforthisoptiontoworkproperly.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
capath<CAcertificatedirectory>
(SSL)Tellscurltousethespecifiedcertificatedirectorytoverifythepeer.Multiple
pathscanbeprovidedbyseparatingthemwith":"(e.g."path1:path2:path3").The
certificatesmustbeinPEMformat,andifcurlisbuiltagainstOpenSSL,thedirectory
musthavebeenprocessedusingthec_rehashutilitysuppliedwithOpenSSL.Using
capathcanallowOpenSSLpoweredcurltomakeSSLconnectionsmuchmore
efficientlythanusingcacertifthecacertfilecontainsmanyCAcertificates.
Ifthisoptionisset,thedefaultcapathvaluewillbeignored,andifitisusedseveral
times,thelastonewillbeused.
pinnedpubkey<pinnedpublickey(hashes)>
(SSL)Tellscurltousethespecifiedpublickeyfile(orhashes)toverifythepeer.This
canbeapathtoafilewhichcontainsasinglepublickeyinPEMorDERformat,or
anynumberofbase64encodedsha256hashesprecededbysha256//and
separatedby
WhennegotiatingaTLSorSSLconnection,theserversendsacertificateindicating
itsidentity.Apublickeyisextractedfromthiscertificateandifitdoesnotexactly
matchthepublickeyprovidedtothisoption,curlwillaborttheconnectionbefore
sendingorreceivinganydata.
PEM/DERsupport:7.39.0:OpenSSL,GnuTLSandGSKit7.43.0:NSSand
wolfSSL/CyaSSL7.47.0:mbedtls7.49.0:PolarSSLsha256support:7.44.0:
OpenSSL,GnuTLS,NSSandwolfSSL/CyaSSL.7.47.0:mbedtls7.49.0:PolarSSL
OtherSSLbackendsnotsupported.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
certstatus
(SSL)TellscurltoverifythestatusoftheservercertificatebyusingtheCertificate
StatusRequest(aka.OCSPstapling)TLSextension.
Ifthisoptionisenabledandtheserversendsaninvalid(e.g.expired)response,ifthe
responsesuggeststhattheservercertificatehasbeenrevoked,ornoresponseatall
isreceived,theverificationfails.
https://curl.haxx.se/docs/manpage.html 12/51
28/04/2016 cURLHowToUse
ThisiscurrentlyonlyimplementedintheOpenSSL,GnuTLSandNSSbackends.
(Addedin7.41.0)
falsestart
(SSL)TellscurltousefalsestartduringtheTLShandshake.Falsestartisamode
whereaTLSclientwillstartsendingapplicationdatabeforeverifyingtheserver's
Finishedmessage,thussavingaroundtripwhenperformingafullhandshake.
ThisiscurrentlyonlyimplementedintheNSSandSecureTransport(oniOS7.0or
later,orOSX10.9orlater)backends.(Addedin7.42.0)
f,fail
(HTTP)Failsilently(nooutputatall)onservererrors.Thisismostlydonetobetter
enablescriptsetctobetterdealwithfailedattempts.InnormalcaseswhenanHTTP
serverfailstodeliveradocument,itreturnsanHTMLdocumentstatingso(which
oftenalsodescribeswhyandmore).Thisflagwillpreventcurlfromoutputtingthat
andreturnerror22.
Thismethodisnotfailsafeandthereareoccasionswherenonsuccessfulresponse
codeswillslipthrough,especiallywhenauthenticationisinvolved(responsecodes
401and407).
F,form<name=content>
(HTTP)Thisletscurlemulateafilledinforminwhichauserhaspressedthesubmit
button.ThiscausescurltoPOSTdatausingtheContentTypemultipart/formdata
accordingtoRFC2388.Thisenablesuploadingofbinaryfilesetc.Toforcethe
'content'parttobeafile,[email protected]
partfromafile,prefixthefilenamewiththesymbol<.Thedifferencebetween@and
<isthenthat@makesafilegetattachedinthepostasafileupload,whilethe<
makesatextfieldandjustgetthecontentsforthattextfieldfromafile.
Example:tosendanimagetoaserver,where'profile'isthenameoftheformfieldto
whichportrait.jpgwillbetheinput:
[email protected]://example.com/upload.cgi
Toreadcontentfromstdininsteadofafile,useasthefilename.Thisgoesforboth
@and<constructs.Unfortunatelyitdoesnotsupportreadingthefilefromanamed
pipeorsimilar,asitneedsthefullsizebeforethetransferstarts.
YoucanalsotellcurlwhatContentTypetousebyusing'type=',inamannersimilar
to:
curlF"[email protected]=text/html"example.com
or
curlF"name=danieltype=text/foo"example.com
Youcanalsoexplicitlychangethenamefieldofafileuploadpartbysetting
filename=,likethis:
curlF"file=@localfilefilename=nameinpost"example.com
https://curl.haxx.se/docs/manpage.html 13/51
28/04/2016 cURLHowToUse
Iffilename/pathcontains','or'',itmustbequotedbydoublequoteslike:
curlF"file=@\"localfile\"filename=\"nameinpost\""example.com
or
curlF'file=@"localfile"filename="nameinpost"'example.com
Notethatifafilename/pathisquotedbydoublequotes,anydoublequoteor
backslashwithinthefilenamemustbeescapedbybackslash.
SeefurtherexamplesanddetailsintheMANUAL.
Thisoptioncanbeusedmultipletimes.
ftpaccount[data]
(FTP)WhenanFTPserverasksfor"accountdata"afterusernameandpassword
hasbeenprovided,thisdataissentoffusingtheACCTcommand.(Addedin7.13.0)
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
ftpalternativetouser<command>
(FTP)IfauthenticatingwiththeUSERandPASScommandsfails,sendthis
command.WhenconnectingtoTumbleweed'sSecureTransportserveroverFTPS
usingaclientcertificate,using"SITEAUTH"willtelltheservertoretrievethe
usernamefromthecertificate.(Addedin7.15.5)
ftpcreatedirs
(FTP/SFTP)WhenanFTPorSFTPURL/operationusesapaththatdoesn'tcurrently
existontheserver,thestandardbehaviorofcurlistofail.Usingthisoption,curlwill
insteadattempttocreatemissingdirectories.
ftpmethod[method]
(FTP)ControlwhatmethodcurlshouldusetoreachafileonanFTP(S)server.The
methodargumentshouldbeoneofthefollowingalternatives:
multicwd
curldoesasingleCWDoperationforeachpathpartinthegivenURL.Fordeep
hierarchiesthismeansverymanycommands.ThisishowRFC1738saysit
shouldbedone.Thisisthedefaultbuttheslowestbehavior.
nocwd
curldoesnoCWDatall.curlwilldoSIZE,RETR,STORetcandgiveafullpath
totheserverforallthesecommands.Thisisthefastestbehavior.
singlecwd
curldoesoneCWDwiththefulltargetdirectoryandthenoperatesonthefile
"normally"(likeinthemulticwdcase).Thisissomewhatmorestandards
compliantthan'nocwd'butwithoutthefullpenaltyof'multicwd'.
https://curl.haxx.se/docs/manpage.html 14/51
28/04/2016 cURLHowToUse
(Addedin7.15.1)
ftppasv
(FTP)Usepassivemodeforthedataconnection.Passiveistheinternaldefault
behavior,butusingthisoptioncanbeusedtooverrideapreviousP/ftpportoption.
(Addedin7.11.0)
Ifthisoptionisusedseveraltimes,onlythefirstoneisused.Undoinganenforced
passivereallyisn'tdoablebutyoumusttheninsteadenforcethecorrectP,ftpport
again.
PassivemodemeansthatcurlwilltrytheEPSVcommandfirstandthenPASV,
unlessdisableepsvisused.
ftpskippasvip
(FTP)TellcurltonotusetheIPaddresstheserversuggestsinitsresponsetocurl's
PASVcommandwhencurlconnectsthedataconnection.Insteadcurlwillreusethe
sameIPaddressitalreadyusesforthecontrolconnection.(Addedin7.14.2)
ThisoptionhasnoeffectifPORT,EPRTorEPSVisusedinsteadofPASV.
ftppret
(FTP)TellcurltosendaPRETcommandbeforePASV(andEPSV).CertainFTP
servers,mainlydrftpd,requirethisnonstandardcommandfordirectorylistingsas
wellasupanddownloadsinPASVmode.(Addedin7.20.x)
ftpsslccc
(FTP)UseCCC(ClearCommandChannel)ShutsdowntheSSL/TLSlayerafter
authenticating.Therestofthecontrolchannelcommunicationwillbeunencrypted.
ThisallowsNATrouterstofollowtheFTPtransaction.Thedefaultmodeispassive.
Seeftpsslcccmodeforothermodes.(Addedin7.16.1)
ftpsslcccmode[active/passive]
(FTP)UseCCC(ClearCommandChannel)SetstheCCCmode.Thepassivemode
willnotinitiatetheshutdown,butinsteadwaitfortheservertodoit,andwillnotreply
totheshutdownfromtheserver.Theactivemodeinitiatestheshutdownandwaitsfor
areplyfromtheserver.(Addedin7.16.2)
ftpsslcontrol
(FTP)RequireSSL/TLSfortheFTPlogin,clearfortransfer.Allowssecure
authentication,butnonencrypteddatatransfersforefficiency.Failsthetransferifthe
serverdoesn'tsupportSSL/TLS.(Addedin7.16.0)thatcanstillbeusedbutwillbe
removedinafutureversion.
ftpssl
(FTP)Thisdeprecatedoptionisnowknownasssl.
ftpsslreqd
https://curl.haxx.se/docs/manpage.html 15/51
28/04/2016 cURLHowToUse
(FTP)Thisdeprecatedoptionisnowknownassslreqd.
formstring<name=string>
(HTTP)Similartoformexceptthatthevaluestringforthenamedparameterisused
literally.Leading'@'and'<'characters,andthe'type='stringinthevaluehaveno
specialmeaning.Usethisinpreferencetoformifthere'sanypossibilitythatthe
stringvaluemayaccidentallytriggerthe'@'or'<'featuresofform.
g,globoff
Thisoptionswitchesoffthe"URLglobbingparser".Whenyousetthisoption,youcan
specifyURLsthatcontaintheletters{}[]withouthavingthembeinginterpretedbycurl
itself.NotethattheselettersarenotnormallegalURLcontentsbuttheyshouldbe
encodedaccordingtotheURIstandard.
G,get
Whenused,thisoptionwillmakealldataspecifiedwithd,data,databinaryor
dataurlencodetobeusedinanHTTPGETrequestinsteadofthePOSTrequestthat
otherwisewouldbeused.ThedatawillbeappendedtotheURLwitha'?'separator.
IfusedincombinationwithI,thePOSTdatawillinsteadbeappendedtotheURL
withaHEADrequest.
Ifthisoptionisusedseveraltimes,onlythefirstoneisused.Thisisbecauseundoing
aGETdoesn'tmakesense,butyoushouldtheninsteadenforcethealternative
methodyouprefer.
H,header<header>
(HTTP)ExtraheadertoincludeintherequestwhensendingHTTPtoaserver.You
mayspecifyanynumberofextraheaders.Notethatifyoushouldaddacustom
headerthathasthesamenameasoneoftheinternalonescurlwoulduse,your
externallysetheaderwillbeusedinsteadoftheinternalone.Thisallowsyoutomake
eventrickierstuffthancurlwouldnormallydo.Youshouldnotreplaceinternallyset
headerswithoutknowingperfectlywellwhatyou'redoing.Removeaninternalheader
bygivingareplacementwithoutcontentontherightsideofthecolon,asin:H
"Host:".Ifyousendthecustomheaderwithnovaluethenitsheadermustbe
terminatedwithasemicolon,suchasH"XCustomHeader"tosend"XCustom
Header:".
curlwillmakesurethateachheaderyouadd/replaceissentwiththeproperendof
linemarker,youshouldthusnotaddthatasapartoftheheadercontent:donotadd
newlinesorcarriagereturns,theywillonlymessthingsupforyou.
SeealsotheA,useragentande,refereroptions.
Startingin7.37.0,youneedproxyheadertosendcustomheadersintendedfora
proxy.
Example:
#curlH"XFirstName:Joe"http://example.com/
WARNING:headerssetwiththisoptionwillbesetinallrequestsevenafter
https://curl.haxx.se/docs/manpage.html 16/51
28/04/2016 cURLHowToUse
redirectsarefollowed,likewhentoldwithL,location.Thiscanleadtotheheader
beingsenttootherhoststhantheoriginalhost,sosensitiveheadersshouldbeused
withcautioncombinedwithfollowingredirects.
Thisoptioncanbeusedmultipletimestoadd/replace/removemultipleheaders.
hostpubmd5<md5>
(SCP/SFTP)Passastringcontaining32hexadecimaldigits.Thestringshouldbethe
128bitMD5checksumoftheremotehost'spublickey,curlwillrefusetheconnection
withthehostunlessthemd5sumsmatch.(Addedin7.17.1)
ignorecontentlength
ForHTTP,IgnoretheContentLengthheader.Thisisparticularlyusefulforservers
runningApache1.x,whichwillreportincorrectContentLengthforfileslargerthan2
gigabytes.
ForFTP(since7.46.0),skiptheRETRcommandtofigureoutthesizebefore
downloadingafile.
i,include
(HTTP)IncludetheHTTPheaderintheoutput.TheHTTPheaderincludesthingslike
servername,dateofthedocument,HTTPversionandmore...
I,head
(HTTP/FTP/FILE)FetchtheHTTPheaderonly!HTTPserversfeaturethecommand
HEADwhichthisusestogetnothingbuttheheaderofadocument.Whenusedonan
FTPorFILEfile,curldisplaysthefilesizeandlastmodificationtimeonly.
interface<name>
Performanoperationusingaspecifiedinterface.Youcanenterinterfacename,IP
addressorhostname.Anexamplecouldlooklike:
curlinterfaceeth0:1https://www.example.com/
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
j,junksessioncookies
(HTTP)Whencurlistoldtoreadcookiesfromagivenfile,thisoptionwillmakeit
discardall"sessioncookies".Thiswillbasicallyhavethesameeffectasifanew
sessionisstarted.Typicalbrowsersalwaysdiscardsessioncookieswhenthey're
closeddown.
J,remoteheadername
(HTTP)ThisoptiontellstheO,remotenameoptiontousetheserverspecified
ContentDispositionfilenameinsteadofextractingafilenamefromtheURL.
Iftheserverspecifiesafilenameandafilewiththatnamealreadyexistsinthe
currentworkingdirectoryitwillnotbeoverwrittenandanerrorwilloccur.Iftheserver
doesn'tspecifyafilenamethenthisoptionhasnoeffect.
https://curl.haxx.se/docs/manpage.html 17/51
28/04/2016 cURLHowToUse
There'snoattempttodecode%sequences(yet)intheprovidedfilename,sothis
optionmayprovideyouwithratherunexpectedfilenames.
WARNING:Exercisejudicioususeofthisoption,especiallyonWindows.Arogue
servercouldsendyouthenameofaDLLorotherfilethatcouldpossiblybeloaded
automaticallybyWindowsorsomethirdpartysoftware.
k,insecure
(SSL)Thisoptionexplicitlyallowscurltoperform"insecure"SSLconnectionsand
transfers.AllSSLconnectionsareattemptedtobemadesecurebyusingtheCA
certificatebundleinstalledbydefault.Thismakesallconnectionsconsidered
"insecure"failunlessk,insecureisused.
Seethisonlineresourceforfurtherdetails:https://curl.haxx.se/docs/sslcerts.html
K,config<configfile>
Specifywhichconfigfiletoreadcurlargumentsfrom.Theconfigfileisatextfilein
whichcommandlineargumentscanbewrittenwhichthenwillbeusedasiftheywere
writtenontheactualcommandline.
Optionsandtheirparametersmustbespecifiedonthesameconfigfileline,
separatedbywhitespace,colon,ortheequalssign.Longoptionnamescanoptionally
begivenintheconfigfilewithouttheinitialdoubledashesandifso,thecolonor
equalscharacterscanbeusedasseparators.Iftheoptionisspecifiedwithoneortwo
dashes,therecanbenocolonorequalscharacterbetweentheoptionandits
parameter.
Iftheparameteristocontainwhitespace,theparametermustbeenclosedwithin
quotes.Withindoublequotes,thefollowingescapesequencesareavailable:\\,\",\t,
\n,\rand\v.Abackslashprecedinganyotherletterisignored.Ifthefirstcolumnofa
configlineisa'#'character,therestofthelinewillbetreatedasacomment.Only
writeoneoptionperphysicallineintheconfigfile.
SpecifythefilenametoK,configas''tomakecurlreadthefilefromstdin.
NotethattobeabletospecifyaURLintheconfigfile,youneedtospecifyitusingthe
urloption,andnotbysimplywritingtheURLonitsownline.So,itcouldlooksimilar
tothis:
url="https://curl.haxx.se/docs/"
Whencurlisinvoked,italways(unlessqisused)checksforadefaultconfigfileand
usesitiffound.Thedefaultconfigfileischeckedforinthefollowingplacesinthis
order:
1)curltriestofindthe"homedir":ItfirstchecksfortheCURL_HOMEandthenthe
HOMEenvironmentvariables.Failingthat,itusesgetpwuid()onUnixlikesystems
(whichreturnsthehomedirgiventhecurrentuserinyoursystem).OnWindows,it
thenchecksfortheAPPDATAvariable,orasalastresortthe
'%USERPROFILE%\ApplicationData'.
2)Onwindows,ifthereisno_curlrcfileinthehomedir,itchecksforoneinthesame
dirthecurlexecutableisplaced.OnUnixlikesystems,itwillsimplytrytoload.curlrc
fromthedeterminedhomedir.
https://curl.haxx.se/docs/manpage.html 18/51
28/04/2016 cURLHowToUse
#Examplefile
#thisisacomment
url="example.com"
output="curlhere.html"
useragent="superagent/1.0"
#andfetchanotherURLtoo
url="example.com/docs/manpage.html"
O
referer="http://nowhereatall.example.com/"
#Endofexamplefile
Thisoptioncanbeusedmultipletimestoloadmultipleconfigfiles.
keepalivetime<seconds>
Thisoptionsetsthetimeaconnectionneedstoremainidlebeforesendingkeepalive
probesandthetimebetweenindividualkeepaliveprobes.Itiscurrentlyeffectiveon
operatingsystemsofferingtheTCP_KEEPIDLEandTCP_KEEPINTVLsocket
options(meaningLinux,recentAIX,HPUXandmore).Thisoptionhasnoeffectif
nokeepaliveisused.(Addedin7.18.0)
Ifthisoptionisusedseveraltimes,thelastonewillbeused.Ifunspecified,theoption
defaultsto60seconds.
key<key>
(SSL/SSH)Privatekeyfilename.Allowsyoutoprovideyourprivatekeyinthis
separatefile.ForSSH,ifnotspecified,curltriesthefollowingcandidatesinorder:
'~/.ssh/id_rsa','~/.ssh/id_dsa','./id_rsa','./id_dsa'.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
keytype<type>
(SSL)Privatekeyfiletype.Specifywhichtypeyourkeyprovidedprivatekeyis.
DER,PEM,andENGaresupported.Ifnotspecified,PEMisassumed.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
krb<level>
(FTP)EnableKerberosauthenticationanduse.Thelevelmustbeenteredandshould
beoneof'clear','safe','confidential',or'private'.Shouldyouusealevelthatisnot
oneofthese,'private'willinsteadbeused.
Thisoptionrequiresalibrarybuiltwithkerberos4support.Thisisnotverycommon.
UseV,versiontoseeifyourcurlsupportsit.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
krb4<level>
(FTP)Thisistheformernameforkrb.Donotuse.
l,listonly
https://curl.haxx.se/docs/manpage.html 19/51
28/04/2016 cURLHowToUse
(FTP)WhenlistinganFTPdirectory,thisswitchforcesanameonlyview.Thisis
especiallyusefuliftheuserwantstomachineparsethecontentsofanFTPdirectory
sincethenormaldirectoryviewdoesn'tuseastandardlookorformat.Whenusedlike
this,theoptioncausesaNLSTcommandtobesenttotheserverinsteadofLIST.
Note:SomeFTPserverslistonlyfilesintheirresponsetoNLSTtheydonotinclude
subdirectoriesandsymboliclinks.
(POP3)WhenretrievingaspecificemailfromPOP3,thisswitchforcesaLIST
commandtobeperformedinsteadofRETR.Thisisparticularlyusefuliftheuser
wantstoseeifaspecificmessageidexistsontheserverandwhatsizeitis.
Note:WhencombinedwithX,request<command>,thisoptioncanbeusedtosend
anUIDLcommandinstead,sotheusermayusetheemail'suniqueidentifierrather
thanit'smessageidtomaketherequest.(Addedin7.21.5)
L,location
(HTTP/HTTPS)Iftheserverreportsthattherequestedpagehasmovedtoadifferent
location(indicatedwithaLocation:headeranda3XXresponsecode),thisoptionwill
makecurlredotherequestonthenewplace.Ifusedtogetherwithi,includeorI,
head,headersfromallrequestedpageswillbeshown.Whenauthenticationisused,
curlonlysendsitscredentialstotheinitialhost.Ifaredirecttakescurltoadifferent
host,itwon'tbeabletointercepttheuser+password.Seealsolocationtrustedon
howtochangethis.Youcanlimittheamountofredirectstofollowbyusingthemax
redirsoption.
WhencurlfollowsaredirectandtherequestisnotaplainGET(forexamplePOSTor
PUT),itwilldothefollowingrequestwithaGETiftheHTTPresponsewas301,302,
or303.Iftheresponsecodewasanyother3xxcode,curlwillresendthefollowing
requestusingthesameunmodifiedmethod.
YoucantellcurltonotchangethenonGETrequestmethodtoGETaftera30x
responsebyusingthededicatedoptionsforthat:post301,post302andpost303.
libcurl<file>
Appendthisoptiontoanyordinarycurlcommandline,andyouwillgetalibcurlusing
Csourcecodewrittentothefilethatdoestheequivalentofwhatyourcommandline
operationdoes!
Ifthisoptionisusedseveraltimes,thelastgivenfilenamewillbeused.(Addedin
7.16.1)
limitrate<speed>
Specifythemaximumtransferrateyouwantcurltouseforbothdownloadsand
uploads.Thisfeatureisusefulifyouhavealimitedpipeandyou'dlikeyourtransfer
nottouseyourentirebandwidth.Tomakeitslowerthanitotherwisewouldbe.
Thegivenspeedismeasuredinbytes/second,unlessasuffixisappended.
Appending'k'or'K'willcountthenumberaskilobytes,'m'orM'makesitmegabytes,
while'g'or'G'makesitgigabytes.Examples:200K,3mand1G.
Thegivenrateistheaveragespeedcountedduringtheentiretransfer.Itmeansthat
curlmightusehighertransferspeedsinshortbursts,butovertimeitusesnomore
https://curl.haxx.se/docs/manpage.html 20/51
28/04/2016 cURLHowToUse
thanthegivenrate.
IfyoualsousetheY,speedlimitoption,thatoptionwilltakeprecedenceandmight
crippletheratelimitingslightly,tohelpkeepingthespeedlimitlogicworking.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
localport<num>[num]
Setapreferrednumberorrangeoflocalportnumberstousefortheconnection(s).
Notethatportnumbersbynatureareascarceresourcethatwillbebusyattimesso
settingthisrangetosomethingtoonarrowmightcauseunnecessaryconnection
setupfailures.(Addedin7.15.2)
locationtrusted
(HTTP/HTTPS)LikeL,location,butwillallowsendingthename+passwordtoall
hoststhatthesitemayredirectto.Thismayormaynotintroduceasecuritybreachif
thesiteredirectsyoutoasitetowhichyou'llsendyourauthenticationinfo(whichis
plaintextinthecaseofHTTPBasicauthentication).
m,maxtime<seconds>
Maximumtimeinsecondsthatyouallowthewholeoperationtotake.Thisisuseful
forpreventingyourbatchjobsfromhangingforhoursduetoslownetworksorlinks
goingdown.Since7.32.0,thisoptionacceptsdecimalvalues,buttheactualtimeout
willdecreaseinaccuracyasthespecifiedtimeoutincreasesindecimalprecision.See
alsotheconnecttimeoutoption.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
loginoptions<options>
Specifytheloginoptionstouseduringserverauthentication.
Youcanusetheloginoptionstospecifyprotocolspecificoptionsthatmaybeused
duringauthentication.AtpresentonlyIMAP,POP3andSMTPsupportloginoptions.
FormoreinformationabouttheloginoptionspleaseseeRFC2384,RFC5092and
IETFdraftdraftearharturlsmtp00.txt(Addedin7.34.0).
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
mailauth<address>
(SMTP)Specifyasingleaddress.Thiswillbeusedtospecifytheauthentication
address(identity)ofasubmittedmessagethatisbeingrelayedtoanotherserver.
(Addedin7.25.0)
mailfrom<address>
(SMTP)Specifyasingleaddressthatthegivenmailshouldgetsentfrom.
(Addedin7.20.0)
maxfilesize<bytes>
https://curl.haxx.se/docs/manpage.html 21/51
28/04/2016 cURLHowToUse
Specifythemaximumsize(inbytes)ofafiletodownload.Ifthefilerequestedis
largerthanthisvalue,thetransferwillnotstartandcurlwillreturnwithexitcode63.
NOTE:Thefilesizeisnotalwaysknownpriortodownload,andforsuchfilesthis
optionhasnoeffectevenifthefiletransferendsupbeinglargerthanthisgivenlimit.
ThisconcernsbothFTPandHTTPtransfers.
mailrcpt<address>
(SMTP)Specifyasingleaddress,usernameormailinglistname.
Whenperformingamailtransfer,therecipientshouldspecifyavalidemailaddressto
sendthemailto.(Addedin7.20.0)
Whenperforminganaddressverification(VRFYcommand),therecipientshouldbe
specifiedastheusernameorusernameanddomain(asperSection3.5ofRFC
5321).(Addedin7.34.0)
Whenperformingamailinglistexpand(EXPNcommand),therecipientshouldbe
specifiedusingthemailinglistname,suchas"Friends"or"LondonOffice".(Addedin
7.34.0)
maxredirs<num>
Setmaximumnumberofredirectionfollowingsallowed.IfL,locationisused,this
optioncanbeusedtopreventcurlfromfollowingredirections"inabsurdum".By
default,thelimitissetto50redirections.Setthisoptionto1tomakeitlimitless.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
metalink
ThisoptioncantellcurltoparseandprocessagivenURIasMetalinkfile(both
version3and4(RFC5854)aresupported)andmakeuseofthemirrorslistedwithin
forfailoverifthereareerrors(suchasthefileorservernotbeingavailable).Itwillalso
verifythehashofthefileafterthedownloadcompletes.TheMetalinkfileitselfis
downloadedandprocessedinmemoryandnotstoredinthelocalfilesystem.
ExampletousearemoteMetalinkfile:
curlmetalinkhttp://www.example.com/example.metalink
TouseaMetalinkfileinthelocalfilesystem,useFILEprotocol(file://):
curlmetalinkfile://example.metalink
PleasenotethatifFILEprotocolisdisabled,thereisnowaytousealocalMetalink
fileatthetimeofthiswriting.Alsonotethatifmetalinkandincludeareused
together,includewillbeignored.Thisisbecauseincludingheadersintheresponse
willbreakMetalinkparserandiftheheadersareincludedinthefiledescribedin
Metalinkfile,hashcheckwillfail.
(Addedin7.27.0,ifbuiltagainstthelibmetalinklibrary.)
n,netrc
https://curl.haxx.se/docs/manpage.html 22/51
28/04/2016 cURLHowToUse
Makescurlscanthe.netrc(_netrconWindows)fileintheuser'shomedirectoryfor
loginnameandpassword.ThisistypicallyusedforFTPonUnix.IfusedwithHTTP,
curlwillenableuserauthentication.Seenetrc(5)ftp(1)fordetailsonthefileformat.
Curlwillnotcomplainifthatfiledoesn'thavetherightpermissions(itshouldnotbe
eitherworldorgroupreadable).Theenvironmentvariable"HOME"isusedtofindthe
homedirectory.
Aquickandverysimpleexampleofhowtosetupa.netrctoallowcurltoFTPtothe
machinehost.domain.comwithusername'myself'andpassword'secret'shouldlook
similarto:
machinehost.domain.comloginmyselfpasswordsecret
N,nobuffer
Disablesthebufferingoftheoutputstream.Innormalworksituations,curlwillusea
standardbufferedoutputstreamthatwillhavetheeffectthatitwilloutputthedatain
chunks,notnecessarilyexactlywhenthedataarrives.Usingthisoptionwilldisable
thatbuffering.
Notethatthisisthenegatedoptionnamedocumented.Youcanthususebufferto
enforcethebuffering.
netrcfile
Thisoptionissimilartonetrc,exceptthatyouprovidethepath(absoluteorrelative)
tothenetrcfilethatCurlshoulduse.Youcanonlyspecifyonenetrcfileper
invocation.Ifseveralnetrcfileoptionsareprovided,onlythelastonewillbeused.
(Addedin7.21.5)
Thisoptionoverridesanyuseofnetrcastheyaremutuallyexclusive.Itwillalso
abidebynetrcoptionalifspecified.
netrcoptional
Verysimilartonetrc,butthisoptionmakesthe.netrcusageoptionalandnot
mandatoryasthenetrcoptiondoes.
negotiate
(HTTP)EnablesNegotiate(SPNEGO)authentication.
IfyouwanttoenableNegotiate(SPNEGO)forproxyauthentication,thenuseproxy
negotiate.
ThisoptionrequiresalibrarybuiltwithGSSAPIorSSPIsupport.UseV,versionto
seeifyourcurlsupportsGSSAPI/SSPIandSPNEGO.
Whenusingthisoption,youmustalsoprovideafakeu,useroptiontoactivatethe
authenticationcodeproperly.Sendinga'u:'isenoughastheusernameand
passwordfromtheuoptionaren'tactuallyused.
Ifthisoptionisusedseveraltimes,onlythefirstoneisused.
nokeepalive
https://curl.haxx.se/docs/manpage.html 23/51
28/04/2016 cURLHowToUse
DisablestheuseofkeepalivemessagesontheTCPconnection,asbydefaultcurl
enablesthem.
Notethatthisisthenegatedoptionnamedocumented.Youcanthususekeepalive
toenforcekeepalive.
nosessionid
(SSL)Disablecurl'suseofSSLsessionIDcaching.Bydefaultalltransfersaredone
usingthecache.Notethatwhilenothingshouldevergethurtbyattemptingtoreuse
SSLsessionIDs,thereseemtobebrokenSSLimplementationsinthewildthatmay
requireyoutodisablethisinorderforyoutosucceed.(Addedin7.16.0)
Notethatthisisthenegatedoptionnamedocumented.Youcanthususesessionid
toenforcesessionIDcaching.
noproxy<noproxylist>
Commaseparatedlistofhostswhichdonotuseaproxy,ifoneisspecified.Theonly
wildcardisasingle*character,whichmatchesallhosts,andeffectivelydisablesthe
proxy.Eachnameinthislistismatchedaseitheradomainwhichcontainsthe
hostname,orthehostnameitself.Forexample,local.comwouldmatchlocal.com,
local.com:80,andwww.local.com,butnotwww.notlocal.com.(Addedin7.19.4).
connectto<host:port:connecttohost:connecttoport>
Forarequesttothegiven"host:port"pair,connectto"connecttohost:connectto
port"instead.Thisissuitabletodirecttherequestataspecificserver,e.g.ata
specificclusternodeinaclusterofservers.Thisoptionisonlyusedtoestablishthe
networkconnection.ItdoesNOTaffectthehostname/portthatisusedforTLS/SSL
(e.g.SNI,certificateverification)orfortheapplicationprotocols."host"and"port"may
betheemptystring,meaning"anyhost/port"."connecttohost"and"connecttoport"
mayalsobetheemptystring,meaning"usetherequest'soriginalhost/port".This
optioncanbeusedmanytimestoaddmanyconnectrules.(Addedin7.49.0).
ntlm
(HTTP)EnablesNTLMauthentication.TheNTLMauthenticationmethodwas
designedbyMicrosoftandisusedbyIISwebservers.Itisaproprietaryprotocol,
reverseengineeredbycleverpeopleandimplementedincurlbasedontheirefforts.
Thiskindofbehaviorshouldnotbeendorsed,youshouldencourageeveryonewho
usesNTLMtoswitchtoapublicanddocumentedauthenticationmethodinstead,
suchasDigest.
IfyouwanttoenableNTLMforyourproxyauthentication,thenuseproxyntlm.
ThisoptionrequiresalibrarybuiltwithSSLsupport.UseV,versiontoseeifyour
curlsupportsNTLM.
Ifthisoptionisusedseveraltimes,onlythefirstoneisused.
ntlmwb
(HTTP)EnablesNTLMmuchinthestylentlmdoes,buthandoverthe
authenticationtotheseparatebinaryntlmauthapplicationthatisexecutedwhen
needed.
https://curl.haxx.se/docs/manpage.html 24/51
28/04/2016 cURLHowToUse
o,output<file>
Writeoutputto<file>insteadofstdout.Ifyouareusing{}or[]tofetchmultiple
documents,youcanuse'#'followedbyanumberinthe<file>specifier.Thatvariable
willbereplacedwiththecurrentstringfortheURLbeingfetched.Likein:
curlhttp://{one,two}.example.como"file_#1.txt"
oruseseveralvariableslike:
curlhttp://{site,host}.host[15].como"#1_#2"
YoumayusethisoptionasmanytimesasthenumberofURLsyouhave.
Seealsothecreatedirsoptiontocreatethelocaldirectoriesdynamically.Specifying
theoutputas''(asingledash)willforcetheoutputtobedonetostdout.
O,remotename
Writeoutputtoalocalfilenamedliketheremotefileweget.(Onlythefilepartofthe
remotefileisused,thepathiscutoff.)
Thefilewillbesavedinthecurrentworkingdirectory.Ifyouwantthefilesavedina
differentdirectory,makesureyouchangethecurrentworkingdirectorybefore
invokingcurlwiththisoption.
TheremotefilenametouseforsavingisextractedfromthegivenURL,nothingelse,
andifitalreadyexistsitwillbeoverwritten.Ifyouwanttheservertobeabletochoose
thefilenamerefertoJ,remoteheadernamewhichcanbeusedinadditiontothis
option.Iftheserverchoosesafilenameandthatnamealreadyexistsitwillnotbe
overwritten.
ThereisnoURLdecodingdoneonthefilename.Ifithas%20orotherURLencoded
partsofthename,theywillendupasisasfilename.
YoumayusethisoptionasmanytimesasthenumberofURLsyouhave.
oauth2bearer
(IMAP,POP3,SMTP)SpecifytheBearerTokenforOAUTH2.0serverauthentication.
TheBearerTokenisusedinconjunctionwiththeusernamewhichcanbespecified
aspartoftheurloru,useroptions.
TheBearerTokenandusernameareformattedaccordingtoRFC6750.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
proxyheader<header>
(HTTP)ExtraheadertoincludeintherequestwhensendingHTTPtoaproxy.You
mayspecifyanynumberofextraheaders.ThisistheequivalentoptiontoH,
headerbutisforproxycommunicationonlylikeinCONNECTrequestswhenyou
wantaseparateheadersenttotheproxytowhatissenttotheactualremotehost.
curlwillmakesurethateachheaderyouadd/replaceissentwiththeproperendof
linemarker,youshouldthusnotaddthatasapartoftheheadercontent:donotadd
https://curl.haxx.se/docs/manpage.html 25/51
28/04/2016 cURLHowToUse
newlinesorcarriagereturns,theywillonlymessthingsupforyou.
Headersspecifiedwiththisoptionwillnotbeincludedinrequeststhatcurlknowswill
notbesenttoaproxy.
Thisoptioncanbeusedmultipletimestoadd/replace/removemultipleheaders.
(Addedin7.37.0)
p,proxytunnel
WhenanHTTPproxyisused(x,proxy),thisoptionwillcausenonHTTPprotocols
toattempttotunnelthroughtheproxyinsteadofmerelyusingittodoHTTPlike
operations.ThetunnelapproachismadewiththeHTTPproxyCONNECTrequest
andrequiresthattheproxyallowsdirectconnecttotheremoteportnumbercurl
wantstotunnelthroughto.
P,ftpport<address>
(FTP)Reversesthedefaultinitiator/listenerroleswhenconnectingwithFTP.This
switchmakescurluseactivemode.Inpractice,curlthentellstheservertoconnect
backtotheclient'sspecifiedaddressandport,whilepassivemodeaskstheserverto
setupanIPaddressandportforittoconnectto.<address>shouldbeoneof:
interface
i.e"eth0"tospecifywhichinterface'sIPaddressyouwanttouse(Unixonly)
IPaddress
i.e"192.168.10.1"tospecifytheexactIPaddress
hostname
i.e"my.host.domain"tospecifythemachine
makecurlpickthesameIPaddressthatisalreadyusedforthecontrol
connection
Ifthisoptionisusedseveraltimes,thelastonewillbeused.DisabletheuseofPORT
withftppasv.DisabletheattempttousetheEPRTcommandinsteadofPORTby
usingdisableeprt.EPRTisreallyPORT++.
Startingin7.19.5,youcanappend":[start][end]"totherightoftheaddress,totellcurl
whatTCPportrangetouse.Thatmeansyouspecifyaportrange,fromalowertoa
highernumber.Asinglenumberworksaswell,butdonotethatitincreasestheriskof
failuresincetheportmaynotbeavailable.
pass<phrase>
(SSL/SSH)Passphrasefortheprivatekey
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
https://curl.haxx.se/docs/manpage.html 26/51
28/04/2016 cURLHowToUse
pathasis
Tellcurltonothandlesequencesof/../or/./inthegivenURLpath.Normallycurlwill
squashormergethemaccordingtostandardsbutwiththisoptionsetyoutellitnotto
dothat.
(Addedin7.42.0)
post301
(HTTP)TellscurltorespectRFC7230/6.4.2andnotconvertPOSTrequestsinto
GETrequestswhenfollowinga301redirection.ThenonRFCbehaviourisubiquitous
inwebbrowsers,socurldoestheconversionbydefaulttomaintainconsistency.
However,aservermayrequireaPOSTtoremainaPOSTaftersucharedirection.
ThisoptionismeaningfulonlywhenusingL,location(Addedin7.17.1)
post302
(HTTP)TellscurltorespectRFC7230/6.4.3andnotconvertPOSTrequestsinto
GETrequestswhenfollowinga302redirection.ThenonRFCbehaviourisubiquitous
inwebbrowsers,socurldoestheconversionbydefaulttomaintainconsistency.
However,aservermayrequireaPOSTtoremainaPOSTaftersucharedirection.
ThisoptionismeaningfulonlywhenusingL,location(Addedin7.19.1)
post303
(HTTP)TellscurltorespectRFC7230/6.4.4andnotconvertPOSTrequestsinto
GETrequestswhenfollowinga303redirection.ThenonRFCbehaviourisubiquitous
inwebbrowsers,socurldoestheconversionbydefaulttomaintainconsistency.
However,aservermayrequireaPOSTtoremainaPOSTaftersucharedirection.
ThisoptionismeaningfulonlywhenusingL,location(Addedin7.26.0)
proto<protocols>
Tellscurltousethelistedprotocolsforitsinitialretrieval.Protocolsareevaluatedleft
toright,arecommaseparated,andareeachaprotocolnameor'all',optionally
prefixedbyzeroormoremodifiers.Availablemodifiersare:
+Permitthisprotocolinadditiontoprotocolsalreadypermitted(thisisthedefault
ifnomodifierisused).
Denythisprotocol,removingitfromthelistofprotocolsalreadypermitted.
=Permitonlythisprotocol(ignoringthelistalreadypermitted),thoughsubjectto
latermodificationbysubsequententriesinthecommaseparatedlist.
Forexample:
protoftpsusesthedefaultprotocols,butdisablesftps
protoall,https,+httponlyenableshttpandhttps
proto=http,httpsalsoonlyenableshttpandhttps
Unknownprotocolsproduceawarning.Thisallowsscriptstosafelyrelyonbeingable
todisablepotentiallydangerousprotocols,withoutrelyinguponsupportforthat
https://curl.haxx.se/docs/manpage.html 27/51
28/04/2016 cURLHowToUse
protocolbeingbuiltintocurltoavoidanerror.
Thisoptioncanbeusedmultipletimes,inwhichcasetheeffectisthesameas
concatenatingtheprotocolsintooneinstanceoftheoption.
(Addedin7.20.2)
protodefault<protocol>
TellscurltouseprotocolforanyURLmissingaschemename.
Example:
protodefaulthttpsftp.mozilla.org
https://ftp.mozilla.org
Anunknownorunsupportedprotocolcauseserror
CURLE_UNSUPPORTED_PROTOCOL.
Thisoptiondoesnotchangethedefaultproxyprotocol(http).
Withoutthisoptioncurlwouldmakeaguessbasedonthehost,seeurlfordetails.
(Addedin7.45.0)
protoredir<protocols>
Tellscurltousethelistedprotocolsonredirect.Seeprotoforhowprotocolsare
represented.
Example:
protoredirall,http,https
AllowonlyHTTPandHTTPSonredirect.
Bydefaultcurlwillallowallprotocolsonredirectexceptseveraldisabledforsecurity
reasons:Since7.19.4FILEandSCParedisabled,andsince7.40.0SMBandSMBS
arealsodisabled.Specifyingallor+allenablesallprotocolsonredirect,including
thosedisabledforsecurity.
(Addedin7.20.2)
proxyanyauth
Tellscurltopickasuitableauthenticationmethodwhencommunicatingwiththegiven
proxy.Thismightcauseanextrarequest/responseroundtrip.(Addedin7.13.2)
proxybasic
TellscurltouseHTTPBasicauthenticationwhencommunicatingwiththegiven
proxy.UsebasicforenablingHTTPBasicwitharemotehost.Basicisthedefault
authenticationmethodcurluseswithproxies.
proxydigest
https://curl.haxx.se/docs/manpage.html 28/51
28/04/2016 cURLHowToUse
TellscurltouseHTTPDigestauthenticationwhencommunicatingwiththegiven
proxy.UsedigestforenablingHTTPDigestwitharemotehost.
proxynegotiate
TellscurltouseHTTPNegotiate(SPNEGO)authenticationwhencommunicatingwith
thegivenproxy.UsenegotiateforenablingHTTPNegotiate(SPNEGO)witha
remotehost.(Addedin7.17.1)
proxyntlm
TellscurltouseHTTPNTLMauthenticationwhencommunicatingwiththegiven
proxy.UsentlmforenablingNTLMwitharemotehost.
proxyservicename<servicename>
Thisoptionallowsyoutochangetheservicenameforproxynegotiation.
Examples:proxynegotiateproxynameproxyservicenamesockdwoulduse
sockd/proxyname.(Addedin7.43.0).
proxy1.0<proxyhost[:port]>
UsethespecifiedHTTP1.0proxy.Iftheportnumberisnotspecified,itisassumedat
port1080.
TheonlydifferencebetweenthisandtheHTTPproxyoption(x,proxy),isthat
attemptstouseCONNECTthroughtheproxywillspecifyanHTTP1.0protocol
insteadofthedefaultHTTP1.1.
pubkey<key>
(SSH)Publickeyfilename.Allowsyoutoprovideyourpublickeyinthisseparatefile.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
(Asof7.39.0,curlattemptstoautomaticallyextractthepublickeyfromtheprivatekey
file,sopassingthisoptionisgenerallynotrequired.Notethatthispublickey
extractionrequireslibcurltobelinkedagainstacopyoflibssh21.2.8orhigherthatis
itselflinkedagainstOpenSSL.)
q,disable
Ifusedasthefirstparameteronthecommandline,thecurlrcconfigfilewillnotbe
readandused.SeetheK,configfordetailsonthedefaultconfigfilesearchpath.
Q,quote<command>
(FTP/SFTP)SendanarbitrarycommandtotheremoteFTPorSFTPserver.Quote
commandsaresentBEFOREthetransfertakesplace(justaftertheinitialPWD
commandinanFTPtransfer,tobeexact).Tomakecommandstakeplaceaftera
successfultransfer,prefixthemwithadash''.Tomakecommandsbesentaftercurl
haschangedtheworkingdirectory,justbeforethetransfercommand(s),prefixthe
commandwitha'+'(thisisonlysupportedforFTP).Youmayspecifyanynumberof
commands.Iftheserverreturnsfailureforoneofthecommands,theentireoperation
willbeaborted.YoumustsendsyntacticallycorrectFTPcommandsasRFC959
https://curl.haxx.se/docs/manpage.html 29/51
28/04/2016 cURLHowToUse
definestoFTPservers,oroneofthecommandslistedbelowtoSFTPservers.This
optioncanbeusedmultipletimes.WhenspeakingtoanFTPserver,prefixthe
commandwithanasterisk(*)tomakecurlcontinueevenifthecommandfailsasby
defaultcurlwillstopatfirstfailure.
SFTPisabinaryprotocol.UnlikeforFTP,curlinterpretsSFTPquotecommandsitself
beforesendingthemtotheserver.Filenamesmaybequotedshellstyletoembed
spacesorspecialcharacters.FollowingisthelistofallsupportedSFTPquote
commands:
chgrpgroupfile
ThechgrpcommandsetsthegroupIDofthefilenamedbythefileoperandtothe
groupIDspecifiedbythegroupoperand.Thegroupoperandisadecimalinteger
groupID.
chmodmodefile
Thechmodcommandmodifiesthefilemodebitsofthespecifiedfile.Themode
operandisanoctalintegermodenumber.
chownuserfile
Thechowncommandsetstheownerofthefilenamedbythefileoperandtothe
userIDspecifiedbytheuseroperand.Theuseroperandisadecimalinteger
userID.
lnsource_filetarget_file
Thelnandsymlinkcommandscreateasymboliclinkatthetarget_filelocation
pointingtothesource_filelocation.
mkdirdirectory_name
Themkdircommandcreatesthedirectorynamedbythedirectory_name
operand.
pwd
Thepwdcommandreturnstheabsolutepathnameofthecurrentworking
directory.
renamesourcetarget
Therenamecommandrenamesthefileordirectorynamedbythesource
operandtothedestinationpathnamedbythetargetoperand.
rmfile
Thermcommandremovesthefilespecifiedbythefileoperand.
rmdirdirectory
Thermdircommandremovesthedirectoryentryspecifiedbythedirectory
operand,provideditisempty.
https://curl.haxx.se/docs/manpage.html 30/51
28/04/2016 cURLHowToUse
symlinksource_filetarget_file
Seeln.
r,range<range>
(HTTP/FTP/SFTP/FILE)Retrieveabyterange(i.eapartialdocument)froma
HTTP/1.1,FTPorSFTPserveroralocalFILE.Rangescanbespecifiedinanumber
ofways.
0499specifiesthefirst500bytes
500999specifiesthesecond500bytes
500specifiesthelast500bytes
9500specifiesthebytesfromoffset9500andforward
00,1specifiesthefirstandlastbyteonly(*)(HTTP)
100199,500599specifiestwoseparate100byteranges(*)(HTTP)
(*)=NOTEthatthiswillcausetheservertoreplywithamultipartresponse!
Onlydigitcharacters(09)arevalidinthe'start'and'stop'fieldsofthe'startstop'
rangesyntax.Ifanondigitcharacterisgivenintherange,theserver'sresponsewill
beunspecified,dependingontheserver'sconfiguration.
YoushouldalsobeawarethatmanyHTTP/1.1serversdonothavethisfeature
enabled,sothatwhenyouattempttogetarange,you'llinsteadgetthewhole
document.
FTPandSFTPrangedownloadsonlysupportthesimple'startstop'syntax(optionally
withoneofthenumbersomitted).FTPusedependsontheextendedFTPcommand
SIZE.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
R,remotetime
Whenused,thiswillmakecurlattempttofigureoutthetimestampoftheremotefile,
andifthatisavailablemakethelocalfilegetthatsametimestamp.
randomfile<file>
(SSL)Specifythepathnametofilecontainingwhatwillbeconsideredasrandom
data.ThedataisusedtoseedtherandomengineforSSLconnections.Seealsothe
egdfileoption.
raw
(HTTP)Whenused,itdisablesallinternalHTTPdecodingofcontentortransfer
encodingsandinsteadmakesthempassedonunaltered,raw.(Addedin7.16.2)
remotenameall
https://curl.haxx.se/docs/manpage.html 31/51
28/04/2016 cURLHowToUse
ThisoptionchangesthedefaultactionforallgivenURLstobedealtwithasifO,
remotenamewereusedforeachone.Soifyouwanttodisablethatforaspecific
URLafterremotenameallhasbeenused,youmustuse"o"ornoremote
name.(Addedin7.19.0)
resolve<host:port:address>
Provideacustomaddressforaspecifichostandportpair.Usingthis,youcanmake
thecurlrequests(s)useaspecifiedaddressandpreventtheotherwisenormally
resolvedaddresstobeused.Consideritasortof/etc/hostsalternativeprovidedon
thecommandline.Theportnumbershouldbethenumberusedforthespecific
protocolthehostwillbeusedfor.Itmeansyouneedseveralentriesifyouwantto
provideaddressforthesamehostbutdifferentports.
Thisoptioncanbeusedmanytimestoaddmanyhostnamestoresolve.
(Addedin7.21.3)
retry<num>
Ifatransienterrorisreturnedwhencurltriestoperformatransfer,itwillretrythis
numberoftimesbeforegivingup.Settingthenumberto0makescurldonoretries
(whichisthedefault).Transienterrormeanseither:atimeout,anFTP4xxresponse
codeoranHTTP5xxresponsecode.
Whencurlisabouttoretryatransfer,itwillfirstwaitonesecondandthenforall
forthcomingretriesitwilldoublethewaitingtimeuntilitreaches10minuteswhich
thenwillbethedelaybetweentherestoftheretries.Byusingretrydelayyou
disablethisexponentialbackoffalgorithm.Seealsoretrymaxtimetolimitthetotal
timeallowedforretries.(Addedin7.12.3)
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
retrydelay<seconds>
Makecurlsleepthisamountoftimebeforeeachretrywhenatransferhasfailedwith
atransienterror(itchangesthedefaultbackofftimealgorithmbetweenretries).This
optionisonlyinterestingifretryisalsoused.Settingthisdelaytozerowillmakecurl
usethedefaultbackofftime.(Addedin7.12.3)
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
retrymaxtime<seconds>
Theretrytimerisresetbeforethefirsttransferattempt.Retrieswillbedoneasusual
(seeretry)aslongasthetimerhasn'treachedthisgivenlimit.Noticethatifthetimer
hasn'treachedthelimit,therequestwillbemadeandwhileperforming,itmaytake
longerthanthisgiventimeperiod.Tolimitasinglerequestsmaximumtime,usem,
maxtime.Setthisoptiontozerotonottimeoutretries.(Addedin7.12.3)
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
s,silent
Silentorquietmode.Don'tshowprogressmeterorerrormessages.MakesCurl
mute.Itwillstilloutputthedatayouaskfor,potentiallyeventotheterminal/stdout
https://curl.haxx.se/docs/manpage.html 32/51
28/04/2016 cURLHowToUse
unlessyouredirectit.
saslir
EnableinitialresponseinSASLauthentication.(Addedin7.31.0)
servicename<servicename>
ThisoptionallowsyoutochangetheservicenameforSPNEGO.
Examples:negotiateservicenamesockdwouldusesockd/servername.(Addedin
7.43.0).
S,showerror
Whenusedwithsitmakescurlshowanerrormessageifitfails.
ssl
(FTP,POP3,IMAP,SMTP)TrytouseSSL/TLSfortheconnection.Revertstoanon
secureconnectioniftheserverdoesn'tsupportSSL/TLS.Seealsoftpsslcontrol
andsslreqdfordifferentlevelsofencryptionrequired.(Addedin7.20.0)
Thisoptionwasformerlyknownasftpssl(Addedin7.11.0).Thatoptionnamecan
stillbeusedbutwillberemovedinafutureversion.
sslreqd
(FTP,POP3,IMAP,SMTP)RequireSSL/TLSfortheconnection.Terminatesthe
connectioniftheserverdoesn'tsupportSSL/TLS.(Addedin7.20.0)
Thisoptionwasformerlyknownasftpsslreqd.
sslallowbeast
(SSL)ThisoptiontellscurltonotworkaroundasecurityflawintheSSL3andTLS1.0
protocolsknownasBEAST.Ifthisoptionisn'tused,theSSLlayermayuse
workaroundsknowntocauseinteroperabilityproblemswithsomeolderSSL
implementations.WARNING:thisoptionloosenstheSSLsecurity,andbyusingthis
flagyouaskforexactlythat.(Addedin7.25.0)
sslnorevoke
(WinSSL)Thisoptiontellscurltodisablecertificaterevocationchecks.WARNING:
thisoptionloosenstheSSLsecurity,andbyusingthisflagyouaskforexactlythat.
(Addedin7.44.0)
socks4<host[:port]>
UsethespecifiedSOCKS4proxy.Iftheportnumberisnotspecified,itisassumedat
port1080.(Addedin7.15.2)
Thisoptionoverridesanyprevioususeofx,proxy,astheyaremutuallyexclusive.
Since7.21.7,thisoptionissuperfluoussinceyoucanspecifyasocks4proxywithx,
proxyusingasocks4://protocolprefix.
https://curl.haxx.se/docs/manpage.html 33/51
28/04/2016 cURLHowToUse
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
socks4a<host[:port]>
UsethespecifiedSOCKS4aproxy.Iftheportnumberisnotspecified,itisassumed
atport1080.(Addedin7.18.0)
Thisoptionoverridesanyprevioususeofx,proxy,astheyaremutuallyexclusive.
Since7.21.7,thisoptionissuperfluoussinceyoucanspecifyasocks4aproxywithx,
proxyusingasocks4a://protocolprefix.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
socks5hostname<host[:port]>
UsethespecifiedSOCKS5proxy(andlettheproxyresolvethehostname).Iftheport
numberisnotspecified,itisassumedatport1080.(Addedin7.18.0)
Thisoptionoverridesanyprevioususeofx,proxy,astheyaremutuallyexclusive.
Since7.21.7,thisoptionissuperfluoussinceyoucanspecifyasocks5hostname
proxywithx,proxyusingasocks5h://protocolprefix.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.(Thisoptionwas
previouslywronglydocumentedandusedassockswithoutthenumberappended.)
socks5<host[:port]>
UsethespecifiedSOCKS5proxybutresolvethehostnamelocally.Iftheport
numberisnotspecified,itisassumedatport1080.
Thisoptionoverridesanyprevioususeofx,proxy,astheyaremutuallyexclusive.
Since7.21.7,thisoptionissuperfluoussinceyoucanspecifyasocks5proxywithx,
proxyusingasocks5://protocolprefix.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.(Thisoptionwas
previouslywronglydocumentedandusedassockswithoutthenumberappended.)
Thisoption(aswellassocks4)doesnotworkwithIPV6,FTPSorLDAP.
socks5gssapiservice<servicename>
Thedefaultservicenameforasocksserverisrcmd/serverfqdn.Thisoptionallows
youtochangeit.
Examples:socks5proxynamesocks5gssapiservicesockdwoulduse
sockd/proxynamesocks5proxynamesocks5gssapiservicesockd/realname
wouldusesockd/realnameforcaseswheretheproxynamedoesnotmatchthe
principalname.(Addedin7.19.4).
socks5gssapinec
AspartoftheGSSAPInegotiationaprotectionmodeisnegotiated.RFC1961says
insection4.3/4.4itshouldbeprotected,buttheNECreferenceimplementationdoes
https://curl.haxx.se/docs/manpage.html 34/51
28/04/2016 cURLHowToUse
not.Theoptionsocks5gssapinecallowstheunprotectedexchangeofthe
protectionmodenegotiation.(Addedin7.19.4).
stderr<file>
Redirectallwritestostderrtothespecifiedfileinstead.Ifthefilenameisaplain'',it
isinsteadwrittentostdout.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
t,telnetoption<OPT=val>
Passoptionstothetelnetprotocol.Supportedoptionsare:
TTYPE=<term>Setstheterminaltype.
XDISPLOC=<Xdisplay>SetstheXdisplaylocation.
NEW_ENV=<var,val>Setsanenvironmentvariable.
T,uploadfile<file>
ThistransfersthespecifiedlocalfiletotheremoteURL.Ifthereisnofilepartinthe
specifiedURL,Curlwillappendthelocalfilename.NOTEthatyoumustuseatrailing
/onthelastdirectorytoreallyprovetoCurlthatthereisnofilenameorcurlwillthink
thatyourlastdirectorynameistheremotefilenametouse.Thatwillmostlikely
causetheuploadoperationtofail.IfthisisusedonanHTTP(S)server,thePUT
commandwillbeused.
Usethefilename""(asingledash)tousestdininsteadofagivenfile.Alternately,
thefilename"."(asingleperiod)maybespecifiedinsteadof""tousestdininnon
blockingmodetoallowreadingserveroutputwhilestdinisbeinguploaded.
YoucanspecifyoneTforeachURLonthecommandline.EachT+URLpair
specifieswhattouploadandtowhere.curlalsosupports"globbing"oftheT
argument,meaningthatyoucanuploadmultiplefilestoasingleURLbyusingthe
sameURLglobbingstylesupportedintheURL,likethis:
curlT"{file1,file2}"http://www.example.com
oreven
curlT"img[11000].png"ftp://ftp.example.com/upload/
tcpnodelay
TurnontheTCP_NODELAYoption.Seethecurl_easy_setopt(3)manpagefor
detailsaboutthisoption.(Addedin7.11.2)
tcpfastopen
EnableuseofTCPFastOpen(RFC7413).(Addedin7.49.0)
tftpblksize<value>
(TFTP)SetTFTPBLKSIZEoption(mustbe>512).Thisistheblocksizethatcurlwill
https://curl.haxx.se/docs/manpage.html 35/51
28/04/2016 cURLHowToUse
trytousewhentransferringdatatoorfromaTFTPserver.Bydefault512byteswill
beused.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
(Addedin7.20.0)
tftpnooptions
(TFTP)TellscurlnottosendTFTPoptionsrequests.
Thisoptionimprovesinteropwithsomelegacyserversthatdonotacknowledgeor
properlyimplementTFTPoptions.Whenthisoptionisusedtftpblksizeisignored.
(Addedin7.48.0)
tlsauthtype<authtype>
SetTLSauthenticationtype.Currently,theonlysupportedoptionis"SRP",forTLS
SRP(RFC5054).Iftlsuserandtlspasswordarespecifiedbuttlsauthtypeisnot,
thenthisoptiondefaultsto"SRP".(Addedin7.21.4)
tlspassword<password>
SetpasswordforusewiththeTLSauthenticationmethodspecifiedwithtlsauthtype.
Requiresthattlsuseralsobeset.(Addedin7.21.4)
tlsuser<user>
SetusernameforusewiththeTLSauthenticationmethodspecifiedwithtlsauthtype.
Requiresthattlspasswordalsobeset.(Addedin7.21.4)
tlsv1.0
(SSL)ForcescurltouseTLSversion1.0whennegotiatingwitharemoteTLSserver.
(Addedin7.34.0)
tlsv1.1
(SSL)ForcescurltouseTLSversion1.1whennegotiatingwitharemoteTLSserver.
(Addedin7.34.0)
tlsv1.2
(SSL)ForcescurltouseTLSversion1.2whennegotiatingwitharemoteTLSserver.
(Addedin7.34.0)
trencoding
(HTTP)RequestacompressedTransferEncodingresponseusingoneofthe
algorithmscurlsupports,anduncompressthedatawhilereceivingit.
(Addedin7.21.6)
trace<file>
Enablesafulltracedumpofallincomingandoutgoingdata,includingdescriptive
https://curl.haxx.se/docs/manpage.html 36/51
28/04/2016 cURLHowToUse
information,tothegivenoutputfile.Use""asfilenametohavetheoutputsentto
stdout.
Thisoptionoverridesprevioususesofv,verboseortraceascii.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
traceascii<file>
Enablesafulltracedumpofallincomingandoutgoingdata,includingdescriptive
information,tothegivenoutputfile.Use""asfilenametohavetheoutputsentto
stdout.
Thisisverysimilartotrace,butleavesoutthehexpartandonlyshowstheASCII
partofthedump.Itmakessmalleroutputthatmightbeeasiertoreadforuntrained
humans.
Thisoptionoverridesprevioususesofv,verboseortrace.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
tracetime
Prependsatimestamptoeachtraceorverboselinethatcurldisplays.(Addedin
7.14.0)
unixsocket<path>
(HTTP)ConnectthroughthisUnixdomainsocket,insteadofusingthenetwork.
(Addedin7.40.0)
u,user<user:password>
Specifytheusernameandpasswordtouseforserverauthentication.Overridesn,
netrcandnetrcoptional.
Ifyousimplyspecifytheusername,curlwillpromptforapassword.
Theusernameandpasswordsaresplituponthefirstcolon,whichmakesit
impossibletouseacolonintheusernamewiththisoption.Thepasswordcan,still.
WhenusingKerberosV5withaWindowsbasedserveryoushouldincludethe
Windowsdomainnameintheusername,inorderfortheservertosuccessfullyobtain
aKerberosTicket.Ifyoudon'tthentheinitialauthenticationhandshakemayfail.
WhenusingNTLM,theusernamecanbespecifiedsimplyastheusername,without
thedomain,ifthereisasingledomainandforestinyoursetupforexample.
TospecifythedomainnameuseeitherDownLevelLogonNameorUPN(User
PrincipalName)formats.Forexample,EXAMPLE\[email protected]
respectively.
IfyouuseaWindowsSSPIenabledcurlbinaryandperformKerberosV5,Negotiate,
NTLMorDigestauthenticationthenyoucantellcurltoselecttheusernameand
passwordfromyourenvironmentbyspecifyingasinglecolonwiththisoption:"u:".
https://curl.haxx.se/docs/manpage.html 37/51
28/04/2016 cURLHowToUse
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
U,proxyuser<user:password>
Specifytheusernameandpasswordtouseforproxyauthentication.
IfyouuseaWindowsSSPIenabledcurlbinaryanddoeitherNegotiateorNTLM
authenticationthenyoucantellcurltoselecttheusernameandpasswordfromyour
environmentbyspecifyingasinglecolonwiththisoption:"U:".
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
url<URL>
SpecifyaURLtofetch.ThisoptionismostlyhandywhenyouwanttospecifyURL(s)
inaconfigfile.
IfthegivenURLismissingaschemename(suchas"http://"or"ftp://"etc)thencurl
willmakeaguessbasedonthehost.Iftheoutermostsubdomainnamematches
DICT,FTP,IMAP,LDAP,POP3orSMTPthenthatprotocolwillbeused,otherwise
HTTPwillbeused.Since7.45.0guessingcanbedisabledbysettingadefault
protocol,seeprotodefaultfordetails.
Thisoptionmaybeusedanynumberoftimes.TocontrolwherethisURLiswritten,
usetheo,outputortheO,remotenameoptions.
v,verbose
Bemoreverbose/talkativeduringtheoperation.Usefulfordebuggingandseeing
what'sgoingon"underthehood".Alinestartingwith'>'means"headerdata"sentby
curl,'<'means"headerdata"receivedbycurlthatishiddeninnormalcases,anda
linestartingwith'*'meansadditionalinfoprovidedbycurl.
NotethatifyouonlywantHTTPheadersintheoutput,i,includemightbethe
optionyou'relookingfor.
Ifyouthinkthisoptionstilldoesn'tgiveyouenoughdetails,considerusingtraceor
traceasciiinstead.
Thisoptionoverridesprevioususesoftraceasciiortrace.
Uses,silenttomakecurlquiet.
w,writeout<format>
Makecurldisplayinformationonstdoutafteracompletedtransfer.Theformatisa
stringthatmaycontainplaintextmixedwithanynumberofvariables.Theformatcan
bespecifiedasaliteral"string",oryoucanhavecurlreadtheformatfromafilewith
"@filename"andtotellcurltoreadtheformatfromstdinyouwrite"@".
Thevariablespresentintheoutputformatwillbesubstitutedbythevalueortextthat
curlthinksfit,asdescribedbelow.Allvariablesarespecifiedas%{variable_name}
andtooutputanormal%youjustwritethemas%%.Youcanoutputanewlineby
using\n,acarriagereturnwith\randatabspacewith\t.
NOTE:The%symbolisaspecialsymbolinthewin32environment,whereall
https://curl.haxx.se/docs/manpage.html 38/51
28/04/2016 cURLHowToUse
occurrencesof%mustbedoubledwhenusingthisoption.
Thevariablesavailableare:
content_typeTheContentTypeoftherequesteddocument,iftherewasany.
filename_effectiveTheultimatefilenamethatcurlwritesoutto.Thisisonly
meaningfulifcurlistoldtowritetoafilewiththeremotenameoroutput
option.It'smostusefulincombinationwiththeremoteheadernameoption.
(Addedin7.26.0)
ftp_entry_pathTheinitialpathcurlendedupinwhenloggingontotheremote
FTPserver.(Addedin7.15.4)
http_codeThenumericalresponsecodethatwasfoundinthelastretrieved
HTTP(S)orFTP(s)transfer.In7.18.2thealiasresponse_codewasaddedto
showthesameinfo.
http_connectThenumericalcodethatwasfoundinthelastresponse(froma
proxy)toacurlCONNECTrequest.(Addedin7.12.4)
local_ipTheIPaddressofthelocalendofthemostrecentlydoneconnection
canbeeitherIPv4orIPv6(Addedin7.29.0)
local_portThelocalportnumberofthemostrecentlydoneconnection(Addedin
7.29.0)
num_connectsNumberofnewconnectsmadeintherecenttransfer.(Addedin
7.12.3)
num_redirectsNumberofredirectsthatwerefollowedintherequest.(Addedin
7.12.3)
redirect_urlWhenanHTTPrequestwasmadewithoutLtofollowredirects,this
variablewillshowtheactualURLaredirectwouldtakeyouto.(Addedin7.18.2)
remote_ipTheremoteIPaddressofthemostrecentlydoneconnectioncanbe
eitherIPv4orIPv6(Addedin7.29.0)
remote_portTheremoteportnumberofthemostrecentlydoneconnection
(Addedin7.29.0)
size_downloadThetotalamountofbytesthatweredownloaded.
size_headerThetotalamountofbytesofthedownloadedheaders.
size_requestThetotalamountofbytesthatweresentintheHTTPrequest.
size_uploadThetotalamountofbytesthatwereuploaded.
speed_downloadTheaveragedownloadspeedthatcurlmeasuredforthe
completedownload.Bytespersecond.
speed_uploadTheaverageuploadspeedthatcurlmeasuredforthecomplete
upload.Bytespersecond.
https://curl.haxx.se/docs/manpage.html 39/51
28/04/2016 cURLHowToUse
ssl_verify_resultTheresultoftheSSLpeercertificateverificationthatwas
requested.0meanstheverificationwassuccessful.(Addedin7.19.0)
time_appconnectThetime,inseconds,ittookfromthestartuntilthe
SSL/SSH/etcconnect/handshaketotheremotehostwascompleted.(Addedin
7.19.0)
time_connectThetime,inseconds,ittookfromthestartuntiltheTCPconnect
totheremotehost(orproxy)wascompleted.
time_namelookupThetime,inseconds,ittookfromthestartuntilthename
resolvingwascompleted.
time_pretransferThetime,inseconds,ittookfromthestartuntilthefiletransfer
wasjustabouttobegin.Thisincludesallpretransfercommandsand
negotiationsthatarespecifictotheparticularprotocol(s)involved.
time_redirectThetime,inseconds,ittookforallredirectionstepsincludename
lookup,connect,pretransferandtransferbeforethefinaltransactionwasstarted.
time_redirectshowsthecompleteexecutiontimeformultipleredirections.(Added
in7.12.3)
time_starttransferThetime,inseconds,ittookfromthestartuntilthefirstbyte
wasjustabouttobetransferred.Thisincludestime_pretransferandalsothetime
theserverneededtocalculatetheresult.
time_totalThetotaltime,inseconds,thatthefulloperationlasted.Thetimewill
bedisplayedwithmillisecondresolution.
url_effectiveTheURLthatwasfetchedlast.Thisismostmeaningfulifyou've
toldcurltofollowlocation:headers.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
x,proxy<[protocol://][user:password@]proxyhost[:port]>
Usethespecifiedproxy.
Theproxystringcanbespecifiedwithaprotocol://prefixtospecifyalternativeproxy
protocols.Usesocks4://,socks4a://,socks5://orsocks5h://torequestthespecific
SOCKSversiontobeused.Noprotocolspecified,http://andallotherswillbetreated
asHTTPproxies.(Theprotocolsupportwasaddedincurl7.21.7)
Iftheportnumberisnotspecifiedintheproxystring,itisassumedtobe1080.
Thisoptionoverridesexistingenvironmentvariablesthatsettheproxytouse.If
there'sanenvironmentvariablesettingaproxy,youcansetproxyto""tooverrideit.
AlloperationsthatareperformedoveranHTTPproxywilltransparentlybeconverted
toHTTP.Itmeansthatcertainprotocolspecificoperationsmightnotbeavailable.
Thisisnotthecaseifyoucantunnelthroughtheproxy,asonewiththep,
proxytunneloption.
UserandpasswordthatmightbeprovidedintheproxystringareURLdecodedby
curl.Thisallowsyoutopassinspecialcharacterssuchas@byusing%40orpassin
acolonwith%3a.
https://curl.haxx.se/docs/manpage.html 40/51
28/04/2016 cURLHowToUse
Theproxyhostcanbespecifiedtheexactsamewayastheproxyenvironment
variables,includingtheprotocolprefix(http://)andtheembeddeduser+password.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
X,request<command>
(HTTP)Specifiesacustomrequestmethodtousewhencommunicatingwiththe
HTTPserver.Thespecifiedrequestmethodwillbeusedinsteadofthemethod
otherwiseused(whichdefaultstoGET).ReadtheHTTP1.1specificationfordetails
andexplanations.CommonadditionalHTTPrequestsincludePUTandDELETE,but
relatedtechnologieslikeWebDAVoffersPROPFIND,COPY,MOVEandmore.
Normallyyoudon'tneedthisoption.AllsortsofGET,HEAD,POSTandPUT
requestsareratherinvokedbyusingdedicatedcommandlineoptions.
ThisoptiononlychangestheactualwordusedintheHTTPrequest,itdoesnotalter
thewaycurlbehaves.SoforexampleifyouwanttomakeaproperHEADrequest,
usingXHEADwillnotsuffice.YouneedtousetheI,headoption.
ThemethodstringyousetwithXwillbeusedforallrequests,whichifyoufor
exampleuseL,locationmaycauseunintendedsideeffectswhencurldoesn't
changerequestmethodaccordingtotheHTTP30xresponsecodesandsimilar.
(FTP)SpecifiesacustomFTPcommandtouseinsteadofLISTwhendoingfilelists
withFTP.
(POP3)SpecifiesacustomPOP3commandtouseinsteadofLISTorRETR.(Added
in7.26.0)
(IMAP)SpecifiesacustomIMAPcommandtouseinsteadofLIST.(Addedin7.30.0)
(SMTP)SpecifiesacustomSMTPcommandtouseinsteadofHELPorVRFY.
(Addedin7.34.0)
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
xattr
Whensavingoutputtoafile,thisoptiontellscurltostorecertainfilemetadatain
extendedfileattributes.Currently,theURLisstoredinthexdg.origin.urlattributeand,
forHTTP,thecontenttypeisstoredinthemime_typeattribute.Ifthefilesystemdoes
notsupportextendedattributes,awarningisissued.
y,speedtime<time>
Ifadownloadisslowerthanspeedlimitbytespersecondduringaspeedtimeperiod,
thedownloadgetsaborted.Ifspeedtimeisused,thedefaultspeedlimitwillbe1
unlesssetwithY.
Thisoptioncontrolstransfersandthuswillnotaffectslowconnectsetc.Ifthisisa
concernforyou,trytheconnecttimeoutoption.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
Y,speedlimit<speed>
https://curl.haxx.se/docs/manpage.html 41/51
28/04/2016 cURLHowToUse
Ifadownloadisslowerthanthisgivenspeed(inbytespersecond)forspeedtime
secondsitgetsaborted.speedtimeissetwithyandis30ifnotset.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
z,timecond<dateexpression>|<file>
(HTTP/FTP)Requestafilethathasbeenmodifiedlaterthanthegiventimeanddate,
oronethathasbeenmodifiedbeforethattime.The<dateexpression>canbeall
sortsofdatestringsorifitdoesn'tmatchanyinternalones,itistakenasafilename
andtriestogetthemodificationdate(mtime)from<file>instead.Seethe
curl_getdate(3)manpagesfordateexpressiondetails.
Startthedateexpressionwithadash()tomakeitrequestforadocumentthatis
olderthanthegivendate/time,defaultisadocumentthatisnewerthanthespecified
date/time.
Ifthisoptionisusedseveraltimes,thelastonewillbeused.
h,help
Usagehelp.Thislistsallcurrentcommandlineoptionswithashortdescription.
M,manual
Manual.Displaythehugehelptext.
V,version
Displaysinformationaboutcurlandthelibcurlversionituses.
Thefirstlineincludesthefullversionofcurl,libcurlandother3rdpartylibrarieslinked
withtheexecutable.
Thesecondline(startswith"Protocols:")showsallprotocolsthatlibcurlreportsto
support.
Thethirdline(startswith"Features:")showsspecificfeatureslibcurlreportstooffer.
Availablefeaturesinclude:
IPv6
YoucanuseIPv6withthis.
krb4
Krb4forFTPissupported.
SSL
SSLversionsofvariousprotocolsaresupported,suchasHTTPS,FTPS,POP3S
andsoon.
libz
AutomaticdecompressionofcompressedfilesoverHTTPissupported.
https://curl.haxx.se/docs/manpage.html 42/51
28/04/2016 cURLHowToUse
NTLM
NTLMauthenticationissupported.
Debug
ThiscurlusesalibcurlbuiltwithDebug.Thisenablesmoreerrortrackingand
memorydebuggingetc.Forcurldevelopersonly!
AsynchDNS
Thiscurlusesasynchronousnameresolves.Asynchronousnameresolvescan
bedoneusingeitherthecaresorthethreadedresolverbackends.
SPNEGO
SPNEGOauthenticationissupported.
Largefile
Thiscurlsupportstransfersoflargefiles,fileslargerthan2GB.
IDN
ThiscurlsupportsIDNinternationaldomainnames.
GSSAPI
GSSAPIissupported.
SSPI
SSPIissupported.
TLSSRP
SRP(SecureRemotePassword)authenticationissupportedforTLS.
HTTP2
HTTP/2supporthasbeenbuiltin.
Metalink
ThiscurlsupportsMetalink(bothversion3and4(RFC5854)),whichdescribes
mirrorsandhashes.curlwillusemirrorsforfailoverifthereareerrors(suchas
thefileorservernotbeingavailable).
FILES
~/.curlrc
Defaultconfigfile,seeK,configfordetails.
ENVIRONMENT
https://curl.haxx.se/docs/manpage.html 43/51
28/04/2016 cURLHowToUse
Theenvironmentvariablescanbespecifiedinlowercaseoruppercase.Thelowercase
versionhasprecedence.http_proxyisanexceptionasitisonlyavailableinlowercase.
Usinganenvironmentvariabletosettheproxyhasthesameeffectasusingtheproxy
option.
http_proxy[protocol://]<host>[:port]
SetstheproxyservertouseforHTTP.
HTTPS_PROXY[protocol://]<host>[:port]
SetstheproxyservertouseforHTTPS.
[urlprotocol]_PROXY[protocol://]<host>[:port]
Setstheproxyservertousefor[urlprotocol],wheretheprotocolisaprotocolthatcurl
supportsandasspecifiedinaURL.FTP,FTPS,POP3,IMAP,SMTP,LDAPetc.
ALL_PROXY[protocol://]<host>[:port]
Setstheproxyservertouseifnoprotocolspecificproxyisset.
NO_PROXY<commaseparatedlistofhosts>
listofhostnamesthatshouldn'tgothroughanyproxy.Ifsettoaasterisk'*'only,it
matchesallhosts.
PROXYPROTOCOLPREFIXES
Sincecurlversion7.21.7,theproxystringmaybespecifiedwithaprotocol://prefixto
specifyalternativeproxyprotocols.
Ifnoprotocolisspecifiedintheproxystringorifthestringdoesn'tmatchasupportedone,
theproxywillbetreatedasanHTTPproxy.
Thesupportedproxyprotocolprefixesareasfollows:
socks4://
Makesittheequivalentofsocks4
socks4a://
Makesittheequivalentofsocks4a
socks5://
Makesittheequivalentofsocks5
socks5h://
Makesittheequivalentofsocks5hostname
EXITCODES
https://curl.haxx.se/docs/manpage.html 44/51
28/04/2016 cURLHowToUse
Thereareabunchofdifferenterrorcodesandtheircorrespondingerrormessagesthat
mayappearduringbadconditions.Atthetimeofthiswriting,theexitcodesare:
Unsupportedprotocol.Thisbuildofcurlhasnosupportforthisprotocol.
Failedtoinitialize.
URLmalformed.Thesyntaxwasnotcorrect.
Afeatureoroptionthatwasneededtoperformthedesiredrequestwasnotenabled
orwasexplicitlydisabledatbuildtime.Tomakecurlabletodothis,youprobably
needanotherbuildoflibcurl!
Couldn'tresolveproxy.Thegivenproxyhostcouldnotberesolved.
Couldn'tresolvehost.Thegivenremotehostwasnotresolved.
Failedtoconnecttohost.
FTPweirdserverreply.Theserversentdatacurlcouldn'tparse.
FTPaccessdenied.Theserverdeniedloginordeniedaccesstotheparticular
resourceordirectoryyouwantedtoreach.Mostoftenyoutriedtochangetoa
directorythatdoesn'texistontheserver.
11
FTPweirdPASSreply.Curlcouldn'tparsethereplysenttothePASSrequest.
13
FTPweirdPASVreply,Curlcouldn'tparsethereplysenttothePASVrequest.
14
FTPweird227format.Curlcouldn'tparsethe227linetheserversent.
15
https://curl.haxx.se/docs/manpage.html 45/51
28/04/2016 cURLHowToUse
FTPcan'tgethost.Couldn'tresolvethehostIPwegotinthe227line.
17
FTPcouldn'tsetbinary.Couldn'tchangetransfermethodtobinary.
18
Partialfile.Onlyapartofthefilewastransferred.
19
FTPcouldn'tdownload/accessthegivenfile,theRETR(orsimilar)commandfailed.
21
FTPquoteerror.Aquotecommandreturnederrorfromtheserver.
22
HTTPpagenotretrieved.Therequestedurlwasnotfoundorreturnedanothererror
withtheHTTPerrorcodebeing400orabove.Thisreturncodeonlyappearsiff,fail
isused.
23
Writeerror.Curlcouldn'twritedatatoalocalfilesystemorsimilar.
25
FTPcouldn'tSTORfile.TheserverdeniedtheSTORoperation,usedforFTP
uploading.
26
Readerror.Variousreadingproblems.
27
Outofmemory.Amemoryallocationrequestfailed.
28
Operationtimeout.Thespecifiedtimeoutperiodwasreachedaccordingtothe
conditions.
30
FTPPORTfailed.ThePORTcommandfailed.NotallFTPserverssupportthePORT
command,trydoingatransferusingPASVinstead!
31
FTPcouldn'tuseREST.TheRESTcommandfailed.Thiscommandisusedfor
resumedFTPtransfers.
33
https://curl.haxx.se/docs/manpage.html 46/51
28/04/2016 cURLHowToUse
HTTPrangeerror.Therange"command"didn'twork.
34
HTTPposterror.Internalpostrequestgenerationerror.
35
SSLconnecterror.TheSSLhandshakingfailed.
36
FTPbaddownloadresume.Couldn'tcontinueanearlieraborteddownload.
37
FILEcouldn'treadfile.Failedtoopenthefile.Permissions?
38
LDAPcannotbind.LDAPbindoperationfailed.
39
LDAPsearchfailed.
41
Functionnotfound.ArequiredLDAPfunctionwasnotfound.
42
Abortedbycallback.Anapplicationtoldcurltoaborttheoperation.
43
Internalerror.Afunctionwascalledwithabadparameter.
45
Interfaceerror.Aspecifiedoutgoinginterfacecouldnotbeused.
47
Toomanyredirects.Whenfollowingredirects,curlhitthemaximumamount.
48
Unknownoptionspecifiedtolibcurl.Thisindicatesthatyoupassedaweirdoptionto
curlthatwaspassedontolibcurlandrejected.Readupinthemanual!
49
Malformedtelnetoption.
51
https://curl.haxx.se/docs/manpage.html 47/51
28/04/2016 cURLHowToUse
Thepeer'sSSLcertificateorSSHMD5fingerprintwasnotOK.
52
Theserverdidn'treplyanything,whichhereisconsideredanerror.
53
SSLcryptoenginenotfound.
54
CannotsetSSLcryptoengineasdefault.
55
Failedsendingnetworkdata.
56
Failureinreceivingnetworkdata.
58
Problemwiththelocalcertificate.
59
Couldn'tusespecifiedSSLcipher.
60
PeercertificatecannotbeauthenticatedwithknownCAcertificates.
61
Unrecognizedtransferencoding.
62
InvalidLDAPURL.
63
Maximumfilesizeexceeded.
64
RequestedFTPSSLlevelfailed.
65
Sendingthedatarequiresarewindthatfailed.
66
FailedtoinitialiseSSLEngine.
https://curl.haxx.se/docs/manpage.html 48/51
28/04/2016 cURLHowToUse
67
Theusername,password,orsimilarwasnotacceptedandcurlfailedtologin.
68
FilenotfoundonTFTPserver.
69
PermissionproblemonTFTPserver.
70
OutofdiskspaceonTFTPserver.
71
IllegalTFTPoperation.
72
UnknownTFTPtransferID.
73
Filealreadyexists(TFTP).
74
Nosuchuser(TFTP).
75
Characterconversionfailed.
76
Characterconversionfunctionsrequired.
77
ProblemwithreadingtheSSLCAcert(path?accessrights?).
78
TheresourcereferencedintheURLdoesnotexist.
79
AnunspecifiederroroccurredduringtheSSHsession.
80
FailedtoshutdowntheSSLconnection.
82
https://curl.haxx.se/docs/manpage.html 49/51
28/04/2016 cURLHowToUse
CouldnotloadCRLfile,missingorwrongformat(addedin7.19.0).
83
Issuercheckfailed(addedin7.19.0).
84
TheFTPPRETcommandfailed
85
RTSP:mismatchofCSeqnumbers
86
RTSP:mismatchofSessionIdentifiers
87
unabletoparseFTPfilelist
88
FTPchunkcallbackreportederror
89
Noconnectionavailable,thesessionwillbequeued
90
SSLpublickeydoesnotmatchedpinnedpublickey
XX
Moreerrorcodeswillappearhereinfuturereleases.Theexistingonesaremeantto
neverchange.
AUTHORS/CONTRIBUTORS
DanielStenbergisthemainauthor,butthewholelistofcontributorsisfoundinthe
separateTHANKSfile.
WWW
https://curl.haxx.se
FTP
ftp://ftp.sunet.se/pub/www/utilities/curl/
SEEALSO
https://curl.haxx.se/docs/manpage.html 50/51
28/04/2016 cURLHowToUse
ftp(1),wget(1)
ThisHTMLpagewasmadewithroffit.
https://curl.haxx.se/docs/manpage.html 51/51