curl命令

curl - transfer a URL

curl是一个利用URL规则在命令行下工作的文件传输工具。它支持文件的上传和下载,所以是综合传输工具,但习惯称curl为下载工具。curl支持包括HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, DICT, TELNET, LDAP or FILE等,还支持POST、cookies、认证、从指定偏移处下载部分文件、用户代理字符串、限速、文件大小、进度条等特征。做网页处理流程和数据检索自动化。

curl的选项非常多

  1. 查看网页源码

    curl www.baidu.com

  2. 保存网页源码

    curl www.baidu.com -o baidu.html

  3. 显示http头信息

    curl -I www.baidu.com

    可用于测试服务是否正常

    [root@www ~]# curl -I www.baidu.com

    HTTP/1.1 200 OK

    Server: bfe/1.0.8.18

    Date: Thu, 19 Apr 2018 02:56:06 GMT

    Content-Type: text/html

    Content-Length: 277

    Last-Modified: Mon, 13 Jun 2016 02:50:04 GMT

    Connection: Keep-Alive

    ETag: "575e1f5c-115"

    Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform

    Pragma: no-cache

    Accept-Ranges: bytes


后续遇到,会补充

猜你喜欢

转载自blog.51cto.com/12107790/2105255