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)
