curl vs Wget
What both commands do
both are command line tools that can download contents from FTP, HTTP and HTTPS
both can send HTTP POST requests
both support HTTP cookies
both are designed to work without user interaction, like from within scripts
both are fully open source and free software
both projects were started in the 90s
both support metalink
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. (库支持:curl是由libcurl支持的,它是一个跨平台的库,拥有一个稳定的API,每个人都可以使用它。主要的差异在于内部实现通过完全不同的方式。与“mere”命令行工具相比,创建一个库要稍微困难一些。)
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. (管道:curl的工作模式相当于unix的‘cat’,它输出更多的内容,输入时全部为管道的形式;wget和‘cp’是相同的模式)
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.\n (单次发送:curl基本上是用来进行单次传输数据传输的。它只传输用户指定的url,不包含任何递归下载逻辑,也不包含任何类型的HTML解析器。)
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. (更多的协议支持:curl支持:“FTP, FTPS, Gopher, HTTP1.1, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS, FILE, POP3, IMAP, SMB/CIFS, SMTP, RTMP and RTSP”; wget支持:"HTTP1.0, 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.
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. 双向能力:curl提供上传,发送能力,wget只提供简单的port.
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 HTTP多部件/表单数据发送:允许用户执行HTTP“上传”,并在一般情况下模拟浏览器,并在更广泛的范围内进行HTTP自动化。
curl supports gzip and deflate Content-Encoding and does automatic decompression (支持gzip和默认的编码格式,自动解压)
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. (递归:与curl相比,Wget的主要强大之处是它可以递归地下载,甚至可以下载从远程资源中引用的所有内容,无论是HTML页面还是FTP目录。)
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 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. (支持传输中断 & 断点续传 -c)
Wget enables more features by default: cookies, redirect-following, time stamping from the remote resource etc. With curl most of those features need to be explicitly enabled. (Wget在默认情况下启用了更多特性:cookie、直接跟踪、来自远程资源的时间戳等,其中大部分特性需要显式地启用。)
Wget can be typed in using only the left hand on a qwerty keyboard! (wget 只需要左手的键盘)
Additional Stuff
Some have argued that I should compare uploading capabilities with wput, but that's a separate tool/project and I don't include that in this comparison.
Two other capable tools with similar feature set include aria2 and axel (dead project?) - try them out!
For a stricter feature by feature comparison (that also compares other similar tools), see the curl comparison table
Thanks
Any problems, please contact me!
转载于:https://blog.51cto.com/duanyifei/1941574