Ubuntu Curl

Datacenter proxies

  • HTTP & SOCKS
  • Price $1.3/IP
  • Locations: DE, RU, US
  • 5% OFF coupon: APFkysWLpG

Visit proxy6.net

How to Install and Use Curl on Ubuntu 20.04 | Linuxize

curl is a command-line utility for transferring data from or to a remote server. With curl, you can download or upload data using one of the supported protocols, including HTTP, HTTPS, SCP, SFTP, and FTP
article explains how to install Curl
on Ubuntu stalling Curl on Ubuntu If you get an error message saying curl command not found when trying to download a file with curl, it means that the curl package is not installed on your Ubuntu is included in the default Ubuntu 20. 04 repositories. The installation is pretty straightforward:sudo apt updatesudo apt install curlOnce the installation is complete, verify it by typing curl in your terminal:curlThe output will look something like this:curl: try ‘curl –help’ or ‘curl –manual’ for more information
That’s it! You have successfully installed curl on your Ubuntu machine, and you can start using curl When used without any option, curl prints the source code of the URL specified as an argument to the standard example, the following command will print the source of the homepage in your terminal window:curl download a file with curl, use either the -o or -O lowercase -o option allows you to specify the name of the saved file:curl -o invoked with uppercase -O, curl saves the file with its original filename:curl -O curl you can also fetch only the HTTP headers of the specified URL:curl -I 200 OK
Date: Mon, 29 Jun 2020 07:10:35 GMT
Server: Apache/2. 4. 7
Content-Location:
Vary: negotiate, accept-language, Accept-Encoding
TCN: choice
Strict-Transport-Security: max-age=63072000
Access-Control-Allow-Origin: (null)
Accept-Ranges: bytes
Cache-Control: max-age=0
Expires: Mon, 29 Jun 2020 07:10:35 GMT
Content-Type: text/html
Content-Language: en
Another common use case of curl is to download files from password-protected FTP servers:curl -u FTP_USERNAME:FTP_PASSWORD Curl is a versatile tool that allows you to send and receive data over the network. Installing Curl on Ubuntu is a pretty simple more information about how to use this tool, visit Curl Command Examples
you have any questions or feedback, feel free to leave a comment.
curl - transfer a URL - Ubuntu Manpage

Datacenter proxies

  • HTTP & SOCKS
  • Price $1.3/IP
  • Locations: DE, RU, US
  • 5% OFF coupon: APFkysWLpG

Visit proxy6.net

curl – transfer a URL – Ubuntu Manpage

Provided by: curl_7. 35. 0-1ubuntu2_amd64 NAME curl – transfer a URL
SYNOPSIS curl [options] [URL… ]
DESCRIPTION curl is a tool to transfer data from or to a server, using one of the supported protocols
(DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP,
RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP). The command is designed to work without
user interaction.
curl offers a busload of useful tricks like proxy support, user authentication, FTP
upload, HTTP post, SSL connections, cookies, file transfer resume, Metalink, and more. As
you will see below, the number of features will make your head spin!
curl is powered by libcurl for all transfer-related features. See libcurl(3) for details.
URL The URL syntax is protocol-dependent. You’ll find a detailed description in RFC 3986.
You can specify multiple URLs or parts of URLs by writing part sets within braces as in:
one, two, three}
or you can get sequences of alphanumeric series by using [] as in:
1-100]
001-100] (with leading zeros)
a-z]
Nested sequences are not supported, but you can use several ones next to each other:
1996-1999]/vol[1-4]/part{a, b, c}
You can specify any amount of URLs on the command line. They will be fetched in a
sequential manner in the specified order.
You can specify a step counter for the ranges to get every Nth number or letter:
1-100:10]
a-z:2]
If you specify URL without protocol prefix, curl will attempt to guess what protocol
you might want. It will then default to HTTP but try other protocols based on often-used
host name prefixes. For example, for host names starting with “ftp. ” curl will assume you
want to speak FTP.
curl will do its best to use what you pass to it as a URL. It is not trying to validate it
as a syntactically correct URL by any means but is instead very liberal with what it
accepts.
curl will attempt to re-use connections for multiple file transfers, so that getting many
files from the same server will not do multiple connects / handshakes. This improves
speed. Of course this is only done on files specified on a single command line and cannot
be used between separate curl invokes.
PROGRESS METER curl normally displays a progress meter during operations, indicating the amount of
transferred data, transfer speeds and estimated time left, etc.
curl displays this data to the terminal by default, so if you invoke curl to do an
operation and it is about to write data to the terminal, it disables the progress meter as
otherwise it would mess up the output mixing progress meter and response data.
If you want a progress meter for HTTP POST or PUT requests, you need to redirect the
response output to a file, using shell redirect (>), -o [file] or similar.
It is not the same case for FTP upload as that operation does not spit out any response
data to the terminal.
If you prefer a progress “bar” instead of the regular meter, -# is your friend.
OPTIONS Options start with one or two dashes. Many of the options require an addition value next
to it.
The short “single-dash” form of the options, -d for example, may be used with or without a
space between it and its value, although a space is a recommended separator. The long
“double-dash” form, –data for example, requires a space between it and its value.
Short version options that don’t need any additional values can be used immediately next
to each other, like for example you can specify all the options -O, -L and -v at once as
-OLv.
In general, all boolean options are enabled with –option and yet again disabled with
–no-option. That is, you use the exact same option name but prefix it with “no-“.
However, in this list we mostly only list and show the –option version of them. (This
concept with –no options was added in 7. 19. 0. Previously most options were toggled on/off
on repeated use of the same command line option. )
-#, –progress-bar
Make curl display progress as a simple progress bar instead of the standard, more
informational, meter.
-0, –1. 0
(HTTP) Tells curl to use HTTP version 1. 0 instead of using its internally
preferred: HTTP 1. 1.
–1. 1
(HTTP) Tells curl to use HTTP version 1. 1. This is the internal default version.
(Added in 7. 33. 0)
–2. 0
(HTTP) Tells curl to issue its requests using HTTP 2. This requires that the
underlying libcurl was built to support it. (Added in 7. 0)
-1, –tlsv1
(SSL) Forces curl to use TLS version 1 when negotiating with a remote TLS server.
-2, –sslv2
(SSL) Forces curl to use SSL version 2 when negotiating with a remote SSL server.
-3, –sslv3
(SSL) Forces curl to use SSL version 3 when negotiating with a remote SSL server.
-4, –ipv4
If curl is capable of resolving an address to multiple IP versions (which it is if
it is IPv6-capable), this option tells curl to resolve names to IPv4 addresses
only.
-6, –ipv6
it is IPv6-capable), this option tells curl to resolve names to IPv6 addresses
-a, –append
(FTP/SFTP) When used in an upload, this will tell curl to append to the target file
instead of overwriting it. If the file doesn’t exist, it will be created. Note
that this flag is ignored by some SSH servers (including OpenSSH).
-A, –user-agent
(HTTP) Specify the User-Agent string to send to the HTTP server. Some badly done
CGIs fail if this field isn’t set to “Mozilla/4. 0”. To encode blanks in the string,
surround the string with single quote marks. This can also be set with the -H,
–header option of course.
If this option is used several times, the last one will be used.
–anyauth
(HTTP) Tells curl to figure out authentication method by itself, and use the most
secure one the remote site claims to support. This is done by first doing a request
and checking the response-headers, thus possibly inducing an extra network round-
trip. This is used instead of setting a specific authentication method, which you
can do with –basic, –digest, –ntlm, and –negotiate.
Note that using –anyauth is not recommended if you do uploads from stdin, since it
may require data to be sent twice and then the client must be able to rewind. If
the need should arise when uploading from stdin, the upload operation will fail.
-b, –cookie
(HTTP) Pass the data to the HTTP server as a cookie. It is supposedly the data
previously received from the server in a “Set-Cookie:” line. The data should be in
the format “NAME1=VALUE1; NAME2=VALUE2”.
If no ‘=’ symbol is used in the line, it is treated as a filename to use to read
previously stored cookie lines from, which should be used in this session if they
match. Using this method also activates the “cookie parser” which will make curl
record incoming cookies too, which may be handy if you’re using this in combination
with the -L, –location option. The file format of the file to read cookies from
should be plain HTTP headers or the Netscape/Mozilla cookie file format.
NOTE that the file specified with -b, –cookie is only used as input. No cookies
will be stored in the file. To store cookies, use the -c, –cookie-jar option or
you could even save the HTTP headers to a file using -D, –dump-header!
-B, –use-ascii
(FTP/LDAP) Enable ASCII transfer. For FTP, this can also be enforced by using an
URL that ends with “;type=A”. This option causes data sent to stdout to be in text
mode for win32 systems.
–basic
(HTTP) Tells curl to use HTTP Basic authentication. This is the default and this
option is usually pointless, unless you use it to override a previously set option
that sets a different authentication method (such as –ntlm, –digest, or
–negotiate).
-c, –cookie-jar
(HTTP) Specify to which file you want curl to write all cookies after a completed
operation. Curl writes all cookies previously read from a specified file as well as
all cookies received from remote server(s). If no cookies are known, no file will
be written. The file will be written using the Netscape cookie file format. If you
set the file name to a single dash, “-“, the cookies will be written to stdout.
This command line option will activate the cookie engine that makes curl record and
use cookies. Another way to activate it is to use the -b, –cookie option.
If the cookie jar can’t be created or written to, the whole curl operation won’t
fail or even report an error clearly. Using -v will get a warning displayed, but
that is the only visible feedback you get about this possibly lethal situation.
If this option is used several times, the last specified file name will be used.
-C, –continue-at
Continue/Resume a previous file transfer at the given offset. The given offset is
the exact number of bytes that will be skipped, counting from the beginning of the
source file before it is transferred to the destination. If used with uploads, the
FTP server command SIZE will not be used by curl.
Use “-C -” to tell curl to automatically find out where/how to resume the transfer.
It then uses the given output/input files to figure that out.
–ciphers (SSL) Specifies which ciphers to use in the connection. The list of ciphers must
specify valid ciphers. Read up on SSL cipher list details on this URL:
NSS ciphers are done differently than OpenSSL and GnuTLS. The full list of NSS
ciphers is in the NSSCipherSuite entry at this URL:
–compressed
(HTTP) Request a compressed response using one of the algorithms curl supports, and
save the uncompressed document. If this option is used and the server sends an
unsupported encoding, curl will report an error.
–connect-timeout
Maximum time in seconds that you allow the connection to the server to take. This
only limits the connection phase, once curl has connected this option is of no more
use. Since 7. 32. 0, this option accepts decimal values, but the actual timeout will
decrease in accuracy as the specified timeout increases in decimal precision. See
also the -m, –max-time option.
–create-dirs
When used in conjunction with the -o option, curl will create the necessary local
directory hierarchy as needed. This option creates the dirs mentioned with the -o
option, nothing else. If the -o file name uses no dir or if the dirs it mentions
already exist, no dir will be created.
To create remote directories when using FTP or SFTP, try –ftp-create-dirs.
–crlf (FTP) Convert LF to CRLF in upload. Useful for MVS (OS/390).
–crlfile
(HTTPS/FTPS) Provide a file using PEM format with a Certificate Revocation List
that may specify peer certificates that are to be considered revoked.
(Added in 7. 7)
-d, –data
(HTTP) Sends the specified data in a POST request to the HTTP server, in the same
way that a browser does when a user has filled in an HTML form and presses the
submit button. This will cause curl to pass the data to the server using the
content-type application/x-www-form-urlencoded. Compare to -F, –form.
-d, –data is the same as –data-ascii. To post data purely binary, you should
instead use the –data-binary option. To URL-encode the value of a form field you
may use –data-urlencode.
If any of these options is used more than once on the same command line, the data
pieces specified will be merged together with a separating &-symbol. Thus, using
‘-d name=daniel -d skill=lousy’ would generate a post chunk that looks like
‘name=daniel&skill=lousy’.
If you start the data with the letter @, the rest should be a file name to read the
data from, or – if you want curl to read the data from stdin. Multiple files can
also be specified. Posting data from a file named ‘foobar’ would thus be done with
–data @foobar. When –data is told to read from a file like that, carriage returns
and newlines will be stripped out.
-D, –dump-header
Write the protocol headers to the specified file.
This option is handy to use when you want to store the headers that an HTTP site
sends to you. Cookies from the headers could then be read in a second curl
invocation by using the -b, –cookie option! The -c, –cookie-jar option is however
a better way to store cookies.
When used in FTP, the FTP server response lines are considered being “headers” and
thus are saved there.
–data-ascii
See -d, –data.
–data-binary
(HTTP) This posts data exactly as specified with no extra processing whatsoever.
If you start the data with the letter @, the rest should be a filename. Data is
posted in a similar manner as –data-ascii does, except that newlines and carriage
returns are preserved and conversions are never done.
If this option is used several times, the ones following the first will append data
as described in -d, –data.
–data-urlencode
(HTTP) This posts data, similar to the other –data options with the exception that
this performs URL-encoding. 18. 0)
To be CGI-compliant, the part should begin with a name followed by a
separator and a content specification. The part can be passed to curl using
one of the following syntaxes:
content
This will make curl URL-encode the content and pass that on. Just be careful
so that the content doesn’t contain any = or @ symbols, as that will then
make the syntax match one of the other cases below!
=content
This will make curl URL-encode the content and pass that on. The preceding =
symbol is not included in the data.
name=content
This will make curl URL-encode the content part and pass that on. Note that
the name part is expected to be URL-encoded already.
@filename
This will make curl load data from the given file (including any newlines),
URL-encode that data and pass it on in the POST.
[email protected]
URL-encode that data and pass it on in the POST. The name part gets an equal
sign appended, resulting in name=urlencoded-file-content. Note that the name
is expected to be URL-encoded already.
–delegation LEVEL
Set LEVEL to tell the server what it is allowed to delegate when it comes to user
credentials. Used with GSS/kerberos.
none Don’t allow any delegation.
policy Delegates if and only if the OK-AS-DELEGATE flag is set in the Kerberos
service ticket, which is a matter of realm policy.
always Unconditionally allow the server to delegate.
–digest
(HTTP) Enables HTTP Digest authentication. This is an authentication scheme that
prevents the password from being sent over the wire in clear text. Use this in
combination with the normal -u, –user option to set user name and password. See
also –ntlm, –negotiate and –anyauth for related options.
If this option is used several times, only the first one is used.
–disable-eprt
(FTP) Tell curl to disable the use of the EPRT and LPRT commands when doing active
FTP transfers. Curl will normally always first attempt to use EPRT, then LPRT
before using PORT, but with this option, it will use PORT right away. EPRT and LPRT
are extensions to the original FTP protocol, and may not work on all servers, but
they enable more functionality in a better way than the traditional PORT command.
–eprt can be used to explicitly enable EPRT again and –no-eprt is an alias for
–disable-eprt.
Disabling EPRT only changes the active behavior. If you want to switch to passive
mode you need to not use -P, –ftp-port or force it with –ftp-pasv.
–disable-epsv
(FTP) Tell curl to disable the use of the EPSV command when doing passive FTP
transfers. Curl will normally always first attempt to use EPSV before PASV, but
with this option, it will not try using EPSV.
–epsv can be used to explicitly enable EPSV again and –no-epsv is an alias for
–disable-epsv.
Disabling EPSV only changes the passive behavior. If you want to switch to active
mode you need to use -P, –ftp-port.
–dns-interface
Tell curl to send outgoing DNS requests through . This option is a
counterpart to –interface (which does not affect DNS). The supplied string must be
an interface name (not an address).
This option requires that libcurl was built with a resolver backend that supports
this operation. The c-ares backend is the only such one. 0)
–dns-ipv4-addr
Tell curl to bind to when making IPv4 DNS requests, so that the DNS
requests originate from this address. The argument should be a single IPv4 address.
–dns-ipv6-addr
Tell curl to bind to when making IPv6 DNS requests, so that the DNS
requests originate from this address. The argument should be a single IPv6 address.
–dns-servers
Set the list of DNS servers to be used instead of the system default. The list of
IP addresses should be separated with commas. Port numbers may also optionally be
given as: after each IP address.
-e, –referer
(HTTP) Sends the “Referer Page” information to the HTTP server. This can also be
set with the -H, –header flag of course. When used with -L, –location you can
append “;auto” to the –referer URL to make curl automatically set the previous URL
when it follows a Location: header. The “;auto” string can be used alone, even if
you don’t set an initial –referer.
-E, –cert
(SSL) Tells curl to use the specified client certificate file when getting a file
with HTTPS, FTPS or another SSL-based protocol. The certificate must be in PKCS#12
format if using Secure Transport, or PEM format if using any other engine. If the
optional password isn’t specified, it will be queried for on the terminal. Note
that this option assumes a “certificate” file that is the private key and the
private certificate concatenated! See –cert and –key to specify them
independently.
If curl is built against the NSS SSL library then this option can tell curl the
nickname of the certificate to use within the NSS database defined by the
environment variable SSL_DIR (or by default /etc/pki/nssdb). If the NSS PEM PKCS#11
module () is available then PEM files may be loaded. If you want to use
a file from the current directory, please precede it with “. /” prefix, in order to
avoid confusion with a nickname. If the nickname contains “:”, it needs to be
preceded by “\” so that it is not recognized as password delimiter. If the

Frequently Asked Questions about ubuntu curl

Leave a Reply

Your email address will not be published. Required fields are marked *