curl vs Wget

本文对比了curl和wget这两个流行的命令行下载工具。curl以其跨平台的libcurl库、丰富的协议支持及更广泛的SSL库兼容性著称;而wget则以其递归下载能力见长。文章详细介绍了两者之间的主要区别。
http://daniel.haxx.se/docs/curl-vs-wget.html

This document started off as a blog entry, but I decided that I should better make a permanent home for this as I'm sure I'll get reasons to update and fix this as time goes by.

The main differences as I see them. Please consider my bias towards curl since after all, curl is my baby - but I have contributed code to Wget as well.

Please let me know if you have other thoughts or comments on this document. Email them to me or reply on the blog entry.

curl
  • Features and 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 is more in the traditional unix-style, it sends more stuff to stdout, and reads more from stdin in a "everything is a pipe" manner.cURL
  • Return codes. curl returns a range of defined and documented return codes for various (error) situations.
  • 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, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS and FILE at the time of this writing. Wget supports HTTP, HTTPS and FTP.
  • More portable. Ironically curl builds and runs on lots of more platforms than wget, in spite of their attempts to keep things conservative. 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 four different SSL/TLS libraries, and it offers more control and wider support for protocol details.
  • curl (or rather libcurl) supports more HTTP authentication methods, and especially when you try over HTTP proxies.
  • 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
Wget
  • Wget is command line only. There's no lib or anything.
  • 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.A gnu head!
  • Older. Wget has traces back to 1995, while curl can be tracked back no longer than 1997.
  • Less 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 indeed been so for several years.
  • HTTP 1.0. Wget still does its HTTP operations using HTTP 1.0, and while that is still working remarkably fine and hardly ever is troublesome to the end-users, it is still a fact. curl has done HTTP 1.1 since March 2001 (while still offering optional 1.0 requests).
  • 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. However trivial, this fact is often mentioned to me when people explain why they prefer downloading with wget.
Additional Stuff

You may argue that I should compare uploading capabilities with wput, but that's a separate tool and I don't include that in this comparison.

For a stricter feature by feature comparison (that also compares other similar tools), see the curl comparison table

Updated: February 16, 2009 18:19 (Central European, Stockholm Sweden)

 

daniel at haxx dot .se
内容概要:本文介绍了ENVI Deep Learning V1.0的操作教程,重点讲解了如何利用ENVI软件进行深度学习模型的训练与应用,以实现遥感图像中特定目标(如集装箱)的自动提取。教程涵盖了从数据准备、标签图像创建、模型初始化与训练,到执行分类及结果优化的完整流程,并介绍了精度评价与通过ENVI Modeler实现一键化建模的方法。系统基于TensorFlow框架,采用ENVINet5(U-Net变体)架构,支持通过点、线、面ROI或分类图生成标签数据,适用于多/高光谱影像的单一类别特征提取。; 适合人群:具备遥感图像处理基础,熟悉ENVI软件操作,从事地理信息、测绘、环境监测等相关领域的技术人员或研究人员,尤其是希望将深度学习技术应用于遥感目标识别的初学者与实践者。; 使用场景及目标:①在遥感影像中自动识别和提取特定地物目标(如车辆、建筑、道路、集装箱等);②掌握ENVI环境下深度学习模型的训练流程与关键参数设置(如Patch Size、Epochs、Class Weight等);③通过模型调优与结果反馈提升分类精度,实现高效自动化信息提取。; 阅读建议:建议结合实际遥感项目边学边练,重点关注标签数据制作、模型参数配置与结果后处理环节,充分利用ENVI Modeler进行自动化建模与参数优化,同时注意软硬件环境(特别是NVIDIA GPU)的配置要求以保障训练效率。
### curlwget 的区别 `curl` 和 `wget` 都是用于在命令行中下载文件的工具,但它们在功能和适用场景上有显著的区别。 #### 支持的协议 - `curl` 支持多种协议,包括但不限于 FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS, FILE, POP3, IMAP, SMTP 和 RTSP [^2]。 - `wget` 主要支持 HTTP, HTTPS 和 FTP 协议 [^2]。 #### 功能特性 - `curl` 是一个多功能工具,它可以用来下载文件,同时也擅长于发送数据和执行 API 请求,比如 POST/GET 请求。它甚至可以被看作是一个精简版的命令行网页浏览器 [^1]。 - `wget` 是一个专注于下载的工具,它简单且专一,非常适合用来下载文件,并且支持递归下载整个网站的功能 [^2]。 #### 下载方式 - `curl` 支持 URL 中包含变量,因此可以批量下载 [^2]。 - `wget` 支持递归下载,这是 `curl` 所不具备的功能之一 [^2]。 #### 用户体验 - `curl` 默认支持 HTTP 1.1 版本,而 `wget` 仅支持 HTTP 1.0 规范 [^2]。 - 对于简单的下载任务,`wget` 提供了一个更为直接的接口 。 - 对于需要更复杂交互的任务,如调试网页或与 Web API 进行交互,`curl` 提供了更多的灵活性 。 ### 使用场景 #### 使用 curl 的场景 - 当需要与 Web API 进行交互时,例如发送 POST 请求 。 - 当需要支持多种协议进行数据传输时 [^2]。 - 当需要自定义 HTTP 请求头或方法时 。 #### 使用 wget 的场景 - 当需要下载单个文件或者多个文件时 [^1]。 - 当需要断点续传功能时 [^1]。 - 当需要镜像整个网站时 [^2]。 ### 示例代码 #### 使用 curl 发送 GET 请求 ```bash curl http://example.com/api/data ``` #### 使用 curl 发送 POST 请求 ```bash curl -X POST -d "param1=value1&param2=value2" http://example.com/api/submit ``` #### 使用 wget 下载单个文件 ```bash wget http://example.com/file.zip ``` #### 使用 wget 断点续传 ```bash wget -c http://example.com/largefile.zip ``` #### 使用 wget 镜像整个网站 ```bash wget --mirror -p --convert-links -P ./local_copy http://example.com/ ```
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值