欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 汽车 > 新车 > wget/curl命令笔记

wget/curl命令笔记

2025/2/9 0:03:32 来源:https://blog.csdn.net/yjkhtddx/article/details/123246295  浏览:    关键词:wget/curl命令笔记

wget/curl命令使用笔记

操作wgetcurl备注
输出到终端wget -q -O - http://example.com/file.zipcurl http://example.com/file.txtcurl默认输出到终端
直接下载wget http://example.com/file.zipcurl -O http://example.com/file.zip文件名与远程文件名相同
发送 JSON 数据wget --header="Content-Type: application/json" --post-data='{"key1":"value1", "key2":"value2"}' http://example.com/apicurl -X POST -H "Content-Type: application/json" -d '{"key1":"value1", "key2":"value2"}' http://example.com/api发送 JSON 数据
gzip压缩wget --compression=gzip http://example.com/compressed.gzcurl --compressed --output - http://example.com/compressed.gz压缩处理
下载指定文件名wget -O localfile.zip http://example.com/file.zipcurl -o localfile.zip http://example.com/file.zip指定文件名
下载到指定路径wget -P /path/to/directory http://example.com/file.zipcurl 不支持仅指定路径curl 智能指定文件名带路径
指定文件名和路径wget -P /path/to/directory -O localfile.zip http://example.com/file.zipcurl -o /path/to/directory/localfile.zip http://example.com/file.zipwget需要分开传两个参数指定路径指定文件名
下载多个文件wget http://example.com/file1.zip http://example.com/file2.zipcurl -O http://example.com/file1.zip -O http://example.com/file2.zip多个文件
断点续传wget -c http://example.com/largefile.zipcurl -C - -O http://example.com/largefile.zip从上次中断的地方继续下载
发送 POST 请求wget --post-data="param1=value1&param2=value2" http://example.com/apicurl -X POST -d "param1=value1&param2=value2" http://example.com/api发送 POST 数据
查看请求和响应详细信息wget -d http://example.comcurl -v http://example.com显示请求和响应的详细信息
下载整个目录wget --mirror --convert-links --adjust-extension --page-requisites --no-parent http://example.com/directorycurl 不直接支持递归下载整个目录wget 支持递归下载

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com