Merge pull request #7073 from cyleft/master

translated done
This commit is contained in:
Xingyu.Wang 2018-01-08 20:28:42 +08:00 committed by GitHub
commit 92aeb36822
2 changed files with 60 additions and 61 deletions

View File

@ -1,61 +0,0 @@
translating by CYLeft
cURL vs. wget: Their Differences, Usage and Which One You Should Use
======
![](https://www.maketecheasier.com/assets/uploads/2017/12/wgc-feat.jpg)
For downloading files directly from the Linux command line, there are two utilities that immediately come to mind: `wget` and `cURL`. They share a lot of features and can easily get many of the same tasks accomplished.
Though they share similar features, they aren't exactly the same. These programs fit slightly different roles and use cases, and do have traits that make each better for certain situations.
### cURL vs wget: Their Similarities
Both wget and cURL can download things. At their core, that's what they both do. They can make requests of the Internet and pull back the requested item. That could be a file, picture, or even the raw HTML of a website.
Both programs are also capable of making HTTP POST requests. This means they can send data to a website, like filling out a form.
Since both are command line tools, they were also both designed to be scriptable. You can include both wget and cURL in your [Bash scripts][1] to automatically interact with online content and retrieve what you need.
### wget Advantages
![wget download][2]
wget is simple and straightforward. It's meant for quick downloads, and it's excellent at it. wget is a single self-contained program. It doesn't require any extra libraries, and it's not meant to do anything beyond the scope of what it does.
Because wget is so tailored for straight downloads, it also has the ability to download recursively. That allows you to download everything on a page or all of the files in an FTP directory at once.
wget also has intelligent defaults. It specifies how to handle a lot of things that a normal browser would, like cookies and redirects, without the need to add any configuration. Lastly, wget works out of the box.
### cURL Advantages
![cURL Download][3]
cURL is a multi-tool. Sure, it can download content from the Internet. It can do a lot more, too.
cURL is powered by a library: libcurl. This means you can write entire programs based on cURL, allowing you to base graphical download pograms on libcurl and get access to all of its functionality.
The wide range or protocols that cURL supports are probably the biggest selling point it has. cURL can access websites over HTTP and HTTPS and can handle FTP in both directions. It supports LDAP and even Samba shares. You can actually use cURL to send and retrieve email.
cURL has some neat security features, too. cURL supports loads of SSL/TLS libraries. It also supports Internet access via proxies, including SOCKS. That means you can use cURL over Tor.
cURL also supports gzip compression to send large amounts of data more easily.
### Closing Thoughts
So should you use cURL or wget? That really depends. If you want to download something quickly without needing to worry about flags, then you should go with wget. It's simple and just works. If you want to do something more complex, cURL should be your immediate choice.
cURL allows you to do a lot more. You can think of cURL like a stripped-down command line web browser. It supports just about every protocol you can think of and can access and interact with nearly all online content. The only is that a browser renders the responses that it receives, and cURL doesn't.
--------------------------------------------------------------------------------
via: https://www.maketecheasier.com/curl-vs-wget/
作者:[Nick Congleton][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.maketecheasier.com/author/nickcongleton/
[1]:https://www.maketecheasier.com/beginners-guide-scripting-linux/
[2]:https://www.maketecheasier.com/assets/uploads/2017/12/wgc-wget.jpg (wget download)
[3]:https://www.maketecheasier.com/assets/uploads/2017/12/wgc-curl.jpg (cURL Download)

View File

@ -0,0 +1,60 @@
cURL VS wget根据两者的差异和使用习惯你应该选用哪一个
======
![](https://www.maketecheasier.com/assets/uploads/2017/12/wgc-feat.jpg)
当想要直接通过 Linux 命令行下载文件马上就能想到两个工具wgetcURL。它们有很多共享的特征可以很轻易的完成一些相同的任务。
虽然它们有一些相似的特征,但它们并不是完全一样。这两个程序适用与不同的场合,在特定场合下,都拥有各自的特性。
### cURL vs wget: 相似之处
wget 和 cURL 都可以下载内容。它们的内核就是这么设计的。它们都可以向互联网发送请求并返回请求项。这可以是文件、图片或者是其他诸如网站的原始 HTML 之类。
这两个程序都可以进行 HTTP POST 请求。这意味着它们都可以向网站发送数据,比如说填充表单什么的。
由于这两者都是命令行工具它们都被设计成脚本程序。wget 和 cURL 都可以写进你的 [Bash 脚本][1] ,自动与新内容交互,下载所需内容。
### wget 的优势
![wget download][2]
wget 简单直接。这意味着你能享受它超凡的下载速度。wget 是一个独立的程序,无需额外的资源库,更不会做出格的事情。
wget 是专业的直接下载程序,支持递归下载。同时,它也允许你在网页或是 FTP 目录下载任何事物。
wget 拥有智能的默认项。他规定了很多在常规浏览器里的事物处理方式,比如 cookies 和重定向这都不需要额外的配置。可以说wget 简直就是无需说明,开罐即食!
### cURL 优势
![cURL Download][3]
cURL是一个多功能工具。当然他可以下载网络内容但同时它也能做更多别的事情。
cURL 技术支持库是libcurl。这就意味着你可以基于 cURL 编写整个程序,允许你在 libcurl 库中基于图形环境下载程序,访问它所有的功能。
cURL 宽泛的网络协议支持可能是其最大的卖点。cURL 支持访问 HTTP 和 HTTPS 协议,能够处理 FTP 传送。它支持 LDAP 协议,甚至支持 Samba 分享。实际上,你还可以用 cURL 收发邮件。
cURL 也有一些简洁的安全特性。cURL 支持安装许多 SSL/TLS 库,也支持通过网络代理访问,包括 SOCKS。这意味着你可以越过 Tor. 使用cURL。
cURL 同样支持让数据发送变得更容易的 gzip 压缩技术。
### 思考总结
那你应该使用 cURL 还是使用 wget这个比较得看实际用途。如果你想快速下载并且没有担心参数标识的需求那你应该使用轻便有效的 wget。如果你想做一些更复杂的使用直觉告诉你你应该选择 cRUL。
cURL 支持你做很多事情。你可以把 cURL想象成一个精简的命令行网页浏览器。它支持几乎你能想到的所有协议可以交互访问几乎所有在线内容。唯一和浏览器不同的是cURL 不能显示接收到的相应信息。
--------------------------------------------------------------------------------
via: https://www.maketecheasier.com/curl-vs-wget/
作者:[Nick Congleton][a]
译者:[译者ID](https://github.com/CYLeft)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.maketecheasier.com/author/nickcongleton/
[1]:https://www.maketecheasier.com/beginners-guide-scripting-linux/
[2]:https://www.maketecheasier.com/assets/uploads/2017/12/wgc-wget.jpg (wget download)
[3]:https://www.maketecheasier.com/assets/uploads/2017/12/wgc-curl.jpg (cURL Download)