38

Both of these curl and wget are use for downloading files, etc. Is there any reason to use one over the other?

closed as primarily opinion-based by dobey, muru, Kaz Wolfe, 2707974, user364819 Sep 29 '15 at 17:10

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Define "proper use" – A.B. Sep 25 '15 at 18:14
  • 12
    Regarding the vote to close as opinion-based: how does asking about the difference between two tools encourage opinion-based answers? – Michael Martin-Smucker Sep 25 '15 at 19:26
  • 1
    @MichaelMartin-Smucker "Suppose I need to download a web page lets say www.google.com, should I look for wget or curl ?" what is that if not opinion-based? – muru Sep 26 '15 at 4:18
  • 2
    @muru, It depends on what you mean by "download a web page". If you mean send an http request and receive back the results, curl is ideal. If you mean download a page, other pages it links to, and related assets, curl will not work, and wget is the only option. There are factual differences between them which make this not opinion based. – barbecue Sep 26 '15 at 14:49
  • 3
    @muru I guess we just have different interpretations of the sentiment behind the question. In my interpretation, the sentiment is: "I've heard of these two tools which seem to do the same thing. What is the difference between them, and when should I choose one over the other? What about in this specific case?" ...which seems like a reasonable question to me. – Michael Martin-Smucker Sep 27 '15 at 4:54
32

After you've defined "proper use", use wget.

Why? That's why:

Recursive! wget's major strong side compared to curl is its ability to download recursively, or even just download everything that is referred to from a remote resource, be it a HTML page or a FTP directory listing.


Shameless copied from here

curl

  • library. curl is powered by libcurl – a cross-platform library with a stable API that can be used by each and everyone. This difference is major since it creates a completely different attitude on how to do things internally. It is also slightly harder to make a library than a "mere" command line tool.

  • pipes. curl works more like the traditional Unix cat command, it sends more stuff to stdout, and reads more from stdin in a "everything is a pipe" manner. wget is more like cp, using the same analogue.

  • Single shot. curl is basically made to do single-shot transfers of data. It transfers just the URLs that the user specifies, and does not contain any recursive downloading logic nor any sort of HTML parser.

  • More protocols. curl supports FTP, FTPS, Gopher, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS, FILE, POP3, IMAP, SMB/CIFS, SMTP, RTMP and RTSP. Wget only supports HTTP, HTTPS and FTP.

  • More portable. curl builds and runs on lots of more platforms than wget. For example: OS/400, TPF and other more "exotic" platforms that aren't straight-forward Unix clones.

  • More SSL libraries and SSL support. curl can be built with one out of eleven (11!) different SSL/TLS libraries, and it offers more control and wider support for protocol details. curl supports public key pinning.

  • HTTP auth. curl supports more HTTP authentication methods, especially over HTTP proxies: Basic, Digest, NTLM and Negotiate

  • SOCKS. curl supports several SOCKS protocol versions for proxy access

  • Bidirectional. curl offers upload and sending capabilities. wget only offers plain HTTP POST support.

  • HTTP multipart/form-data sending, which allows users to do HTTP "upload" and in general emulate browsers and do HTTP automation to a wider extent

  • curl supports gzip and inflate Content-Encoding and does automatic decompression

  • curl offers and performs decompression of Transfer-Encoded HTTP, wget doesn't

  • curl supports HTTP/2 and it does dual-stack connects using Happy Eyeballs

  • Much more developer activity. While this can be debated, I consider three metrics here: mailing list activity, source code commit frequency and release frequency. Anyone following these two projects can see that the curl project has a lot higher pace in all these areas, and it has been so for 10+ years. Compare on openhub


wget

  • wget is command line only. There's no library.

  • Recursive! wget's major strong side compared to curl is its ability to download recursively, or even just download everything that is referred to from a remote resource, be it a HTML page or a FTP directory listing.

  • Older. wget has traces back to 1995, while curl can be tracked back no earlier than the end of 1996.

  • GPL. wget is 100% GPL v3. curl is MIT licensed.

  • GNU. wget is part of the GNU project and all copyrights are assigned to FSF. The curl project is entirely stand-alone and independent with no organization parenting at all with almost all copyrights owned by Daniel.

  • wget requires no extra options to simply download a remote URL to a local file, while curl requires -o or -O.

  • wget supports the Public Suffix List for handling cookie domains, curl does not.

  • wget supports only GnuTLS or OpenSSL for SSL/TLS support

  • wget supports only Basic auth as the only auth type over HTTP proxy

  • wget has no SOCKS support

  • Its ability to recover from a prematurely broken transfer and continue downloading has no counterpart in curl.

  • wget can be typed in using only the left hand on a qwerty keyboard!

  • 1
    Yes, wget is great for mirroring! – joeytwiddle Sep 25 '15 at 21:43
  • 1
    "The curl project is entirely stand-alone and independent with no organization parenting at all with almost all copyrights owned by Daniel." Not sure that's a bad thing... – barbecue Sep 26 '15 at 15:44
  • "Its ability to recover from a prematurely broken transfer and continue downloading has no counterpart in curl." Did I understand this sentence wrong? Isn't curl -C - continuing broken download? – Siyuan Ren Sep 27 '15 at 5:42
  • 1
    Why do you recommend wget? Even after looking at the comparisons which you wrote yourself, curl sounds to be far superior. wget can be typed in using only the left hand on a qwerty keyboard!, wget requires no extra options to simply download a remote URL to a local file, while curl requires -o or -O. WTF?? – Anmol Singh Jaggi Jul 8 '16 at 2:48
  • 2
    Size matters too: on a fresh ubuntu image, wget size is 2M vs. curl 5M packed (with deps, x3 total unpacked) – Eran W Jun 13 '17 at 4:32
19

There are many tools that can download like curl ,snarf , wget, pavuk, fget, fetch, lftp ,aria2 , HTTrack etc. Use it according to your requirement and which feature you want to use along with downloading. Check feature table and use accordingly .

Curl :

  • Curl support more protocol FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS, FILE, POP3, IMAP, SMTP, RTMP and RTSP
  • Curl support more SSL libraries
  • Curl supports more HTTP authentication methods, especially over HTTP proxies: Basic, Digest, NTLM and Negotiate
  • Curl is powered by libcurl -a cross-platform library with a stable API that can be used by each and everyone

Wget :

  • While wget supports HTTP, HTTPS and FTP
  • Wget supports only GnuTLS or OpenSSL for SSL/TLS support
  • Wget supports only Basic auth as the only auth type over HTTP proxy
  • Wget is command line tool only, it has no library.

Important Resources for more info :

  • "wget is command line tool only it have know library." I don't understand that line. – Lucio Sep 25 '15 at 19:12
3

They have much functionality in common, but curl has more options. For wget it may occasionally be sufficient to leaf through man wget, but for curl I need to study this webpage in a browser. I believe anything your browser can do, curl can do as well.

2

There's another difference between wget and curl which I think is significant.

Wget is a stand-alone command line utility that's intended primarily for retrieving internet content quickly and simply.

Curl on the other hand is basically a terminal front end for the powerful libcurl library. Libcurl provides a very powerful set of tools for working with URLs in all their forms and flavors, and is available for almost all languages and platforms. Curl basically gives you the ability to use this library in shell scripts.

Not the answer you're looking for? Browse other questions tagged or ask your own question.