Linux 什么更好,curl 或 wget?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/636339/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 17:05:27  来源:igfitidea点击:

What is better, curl or wget?

linuxcurlwget

提问by flybywire

Are they the same or not? Can certain things be done with one but not the other? What are those? Or is it, at the end of the day, a matter of familiarity?

它们是一样的还是不一样的?某些事情可以用一个而不是另一个来完成吗?那些是什么?或者,归根结底,这是一个熟悉的问题?

回答by Guemundur H

They both offer endless options, most of which I've never used. However, I tend to like wget more as it by default saves the output from the URL you give — perfect for downloading. Curl goes the other way, and displays the output directly to the terminal (by default).

它们都提供了无穷无尽的选择,其中大部分我从未使用过。但是,我更喜欢 wget,因为它默认保存您提供的 URL 的输出 — 非常适合下载。Curl 则相反,将输出直接显示到终端(默认情况下)。

回答by Byron Whitlock

If you are programming, you should use curl. It has a nice api and is available for most languages. Shelling out to the os to run wget is a kludge and shouldn't be done if you have an API interface!

如果你正在编程,你应该使用 curl。它有一个很好的 api,可用于大多数语言。到操作系统去运行 wget 是一个麻烦事,如果你有一个 API 接口,就不应该这样做!

回答by David Kim

There is some overlap in functionality. While GNU wgetis a package for retrieving files using HTTP/FTP, curltransfers data with single URL. As noted in the link shared by MarkusQ, wget can download recursively - see this comparison articlefor more details by the curl author.

功能上有一些重叠。虽然GNU wget是一个使用 HTTP/FTP 检索文件的包,但curl使用单个 URL 传输数据。正如MarkusQ共享的链接中所指出的,wget 可以递归下载 -有关 curl 作者的更多详细信息,请参阅这篇比较文章

回答by icedwater

cURLis intended for data transfer in both directions while wgetis for non-interactive downloading file(s) from a particular source. There are someoverlaps in functionality, but they are not meantto do exactly the same things.

cURL用于双向数据传输,而wget用于从特定来源非交互式下载文件。在功能上有一些重叠,但它们并不意味着做完全相同的事情

It really depends on what you are trying to do; for simpler tasks like downloading files wgetand cURLare comparable, but this really only scratches the surface of either tool.

这真的取决于你想要做什么;对于更简单的任务,比如下载文件wgetcURL它们是可比的,但这实际上只是触及了任一工具的表面。