Curl: Difference between revisions

Content added Content deleted
m (Protected "Curl" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite) [Delete=Allow only administrators] (indefinite)))
(→‎One-Liners: added data raw)
Line 62: Line 62:


=One-Liners=
=One-Liners=
Save the output of the URL to a file curl -o website https://domain.com
Save the output of the URL to a file curl -o website.html https://domain.com
Download files with cURL curl -O https://domain.com/file.zip
curl -O https://domain.com/file.zip -O https://domain.com/file2.zip
curl -o archive.zip https://domain.com/file.zip
curl -o archive.zip https://domain.com/file.zip
curl https://domain.com > website.html
Save with name same as remote file curl -O https://domain.com/file.zip
curl -O https://domain.com/file.zip -O https://domain.com/file2.zip
Download files securely via SSH curl -u user sftp://server.domain.com/path/to/file
Download files securely via SSH curl -u user sftp://server.domain.com/path/to/file
curl -u username:password download_URL
Get HTTP header information curl -I http://domain.com
Get HTTP header information curl -I http://domain.com
Access an FTP server curl ftp://ftp.domain.com --user username:password
Access an FTP server curl ftp://ftp.domain.com --user username:password
Download a file via FTP curl ftp://ftp.domain.com/file.zip --user username:password
Download a file via FTP curl ftp://ftp.domain.com/file.zip --user username:password
curl -u ftpuser:password -O ftp://ftp_pub/public_html/index.html
Upload a file to the FTP server curl -T file.zip ftp://ftp.domain.com/ --user username:password
Upload a file to the FTP server curl -T file.zip ftp://ftp.domain.com/ --user username:password
curl -u ftpuser:password -T linuxtechi.txt ftp://ftp_pub/public_html/

To upload multiple files to FTP serve curl -u ftpuser:password -T "(linuxtechi1.txt linuxtechi2.txt)" ftp://ftp_pub/public_html/
Deleting files from ftp server curl ftp://ftp_pub/public_html -X 'DELE linuxtechi.zip' --user ftpuser:password
Handle URL redirects curl -L http://domain.com
Debug level details curl -v http://domain.com
Using proxy to download a file curl -x proxy.server.com:3128 download_URL
Limit data transfer rate curl --limit-rate 1024B -O download_URL
Download file modified after a given date curl -z 1-Jan-17 download_URL
Download file modified before a given date curl -z -1-Jan-17 download_URL
Resume a download curl -C download_URL
Verifying SSL certificate curl --cacert new-ca.crt download_URL
Ignoring the ssl certificate warning curl -k download_url


=URL syntax=
=URL syntax=