command line tool and library for transferring data with URLs

官网:https://curl.haxx.se/

everything curl: https://ec.haxx.se/

查看版本信息:

curl --version

verbose mode
当你使用过程中有任何错误,都可以使用 -v 来显示详细处理过程:

$ curl -v http://example.com -o saved
* Rebuilt URL to: http://example.com/
*   Trying 93.184.216.34...
...

下载文件

下载一个文件输出到 stdout:

curl http://example.com

保存远程文件本身的文件名:(--remote-name)

curl -O http://example.com/file.html

保存为特定文件名:(--output)

curl http://example.com -o output.html

下载 ftp 文件:

curl ftp://ftp.example.com/directory/
curl --user daniel:secret ftp://example.com/download

下载 sftp 文件:

curl sftp://example.com/file.zip -u user

下载 scp 文件:

curl scp://example.com/file.zip -u user

下载文件跳过 ssl 证书验证:

curl -k -O http://example.com/file.html

其他功能

修改请求头 HEAD 信息:

curl -H "Host: www.example.com" http://localhost/

设置 http/socks5 代理:

curl -x 192.168.0.1:8080 http:/example.com/
curl -x socks5://127.0.0.1:1080 http://www.example.com/

wget 也是类似的工具,参考教程:https://blog.niekun.net/archives/484.html

标签:curl

你的评论