How can I download ZIP file with curl command? I tried curl -sO
, but error occurred. I want to download zip file from address:
http://github.com/ziyaddin/xampp/archive/master.zip
but can't. What must I type?
How can I download ZIP file with curl command? I tried curl -sO
, but error occurred. I want to download zip file from address:
http://github.com/ziyaddin/xampp/archive/master.zip
but can't. What must I type?
I used
curl -LO
and it worked fine.wget
works too.Try wget instead of curl:
wget http://github.com/ziyaddin/xampp/archive/master.zip
You can use:
Saves as:
xampp-cli-master.zip
-L
in case there is a redirect found.-O
for remote filenames (master.zip
)-J
(use with-O
) to allow remote header filename (xampp-cli-master.zip
)Or use
-o
to create your own filename:curl https://github.com/ziyaddin/xampp/archive/master.zip -L -o MyFilename.zip
Saves as:
MyFilename.zip
Note: (GitHub supports SSL - use
https://
)You could also use a
curlrc
config file or alias the CURL command to usecurl -O -L
to allow it to work similar to WGET.Consult: https://curl.haxx.se/docs/manpage.html#OPTIONS (See: -O, -J, -L, -o)
Note the warning of using CURL with the -J option:
If you want to download the file use
wget [option]... [URL]...
instead.For more information regarding the options, just type this into your Terminal:
man wget
For you purpose:
wget http://github.com/ziyaddin/xampp/archive/master.zip
Note that the .zip file will be saved in the current directory you are in.
To download files in GitHub (or any other site that make redirects) using
curl
, you must pass-L
(Follow redirects), so use:curl -L http://github.com/ziyaddin/xampp/archive/master.zip -o xampp.zip
"curl -LOk" makes it using insecure protocols (-k), disabling SSL certificate checks (which fail because of the incorrect path not matching the certificate), and create the output file using the filename (-O) proposed from the remote server (also insecure). In my opinion, the server should better be configured create local redirecting aliases where needed, to avoid having to pass this non conforming part of the URL. But the redirection is made using an HTTP redirect only (HTTP error 30x), which causes problems to curl that does not follow (by default) this (unsecure) redirection, and option (-k) disables this security check. So instead of using HTTP redirects (moved permanently), please add some internal link on the filesystem of the server. If this is needed because the URL is in fact hosted on another physical server with no direct access between their filesystems, you should use another DNS name for this host, so that clients will query the correct one directly, without any redirect. Then fix your web pages (you may use your webserver logs to see where HTTP 30x redirects are returned and which webpages may need to be checked and updated). Forcing clients to use unsecure/unchecked protocols is not a good option.
So this is definitely a problem of very bad configuration on the web server: try contacting their admin to fix that.
well, you can use Axel as well. axel is a light command line download accelerator. it supports
HTTP, HTTPS, FTP
andFTPS
protocols. its nice and faster alternative.install
axel
using :then download your file by:
Use the option
-L
to follow redirects, you can use also the--output
option to give a path and a name to the zip file. For example:Note: Use sudo if you don't have permissions to write to the target folder.