curl wget命令
curl -o /dev/null -s -w " time_namelookup: %{time_namelookup}\n time_connect: %{time_connect}\n time_appconnect: %{time_appconnect}\n time_redirect: %{time_redirect}\n time_pretransfer: %{time_pretransfer}\n time_starttransfer: %{time_starttransfer}\n -----------------------------\n time_total: %{time_total}" "http[s]://<IP/域名>[:<端口>]"
time_namelookup:DNS 域名解析的时候,就是把https://www.baidu.com
转换成 ip 地址的过程
time_connect:TCP 连接建立的时间,就是三次握手的时间
time_appconnect:SSL/SSH 等上层协议建立连接的时间,比如 connect/handshake 的时间
time_redirect:从开始到最后一个请求事务的时间
time_pretransfer:从请求开始到响应开始传输的时间
time_starttransfer:从请求开始到第一个字节将要传输的时间
time_total:这次请求花费的全部时间
speed_download:下载速度 单位 byte/s
-
-w
:从文件中读取要打印信息的格式 -
-o /dev/null
:把响应的内容丢弃,因为我们这里并不关心它,只关心请求的耗时情况 -
-s
:不要打印进度条
Options: (H) means HTTP/HTTPS only, (F) means FTP only
--anyauth Pick "any" authentication method (H) 可以使用“任何”身份验证方法
-a, --append Append to target file when uploading (F/SFTP) 上传文件时,附加到目标文件
--basic Use HTTP Basic Authentication (H) 使用HTTP基本验证
--cacert FILE CA certificate to verify peer against (SSL) CA证书 (SSL)
--capath DIR CA directory to verify peer against (SSL) CA目录
-E, --cert CERT[:PASSWD] Client certificate file and password (SSL) 客户端证书文件和密码 (SSL)
--cert-type TYPE Certificate file type (DER/PEM/ENG) (SSL) 证书文件类型 (DER/PEM/ENG) (SSL)
--ciphers LIST SSL ciphers to use (SSL) SSL密码
--compressed Request compressed response (using deflate or gzip) 要求返回是压缩的形势 (using deflate or gzip)
-K, --config FILE Specify which config file to read 指定的配置文件读取
--connect-timeout SECONDS Maximum time allowed for connection 设置最大请求时间
-C, --continue-at OFFSET Resumed transfer offset 断点续转
-b, --cookie STRING/FILE String or file to read cookies from (H) cookie字符串或文件读取位置
-c, --cookie-jar FILE Write cookies to this file after operation (H) 操作结束后把cookie写入到这个文件中
--create-dirs Create necessary local directory hierarchy 建立本地目录的目录层次结构
--crlf Convert LF to CRLF in upload 上传是把LF转变成CRLF
--crlfile FILE Get a CRL list in PEM format from the given file
-d, --data DATA HTTP POST data (H) HTTP POST方式传送数据
--data-ascii DATA HTTP POST ASCII data (H) 以ascii的方式post数据
--data-binary DATA HTTP POST binary data (H) 以二进制的方式post数据
--data-urlencode DATA HTTP POST data url encoded (H) 参数等同于-d
,发送 POST 请求的数据体,区别在于会自动将发送的数据进行 URL 编码
--delegation STRING GSS-API delegation permission
--digest Use HTTP Digest Authentication (H) 使用数字身份验证
--disable-eprt Inhibit using EPRT or LPRT (F) 禁止使用EPRT或LPRT
--disable-epsv Inhibit using EPSV (F) 禁止使用EPSV
-D, --dump-header FILE Write the headers to this file 把header信息写入到该文件中
--egd-file FILE EGD socket path for random data (SSL) 为随机数据(SSL)设置EGD socket路径
--engine ENGINGE Crypto engine (SSL). "--engine list" for list 加密引擎使用 (SSL)
-f, --fail Fail silently (no output at all) on HTTP errors (H) 连接失败时不显示http错误
-F, --form CONTENT Specify HTTP multipart POST data (H) 模拟http表单提交数据
--form-string STRING Specify HTTP multipart POST data (H) 模拟http表单提交数据
--ftp-account DATA Account data string (F)
--ftp-alternative-to-user COMMAND String to replace "USER [name]" (F)
--ftp-create-dirs Create the remote dirs if not present (F)
--ftp-method [MULTICWD/NOCWD/SINGLECWD] Control CWD usage (F)
--ftp-pasv Use PASV/EPSV instead of PORT (F) 使用 PASV/EPSV 代替端口
-P, --ftp-port ADR Use PORT with given address instead of PASV (F) 使用端口地址,而不是使用PASV
--ftp-skip-pasv-ip Skip the IP address for PASV (F)
--ftp-pret Send PRET before PASV (for drftpd) (F)
--ftp-ssl-ccc Send CCC after authenticating (F)
--ftp-ssl-ccc-mode ACTIVE/PASSIVE Set CCC mode (F)
--ftp-ssl-control Require SSL/TLS for ftp login, clear for transfer (F)
-G, --get Send the -d data with a HTTP GET (H) 以get的方式来发送数据
-g, --globoff Disable URL sequences and ranges using {} and [] 禁用网址序列和范围使用{}和[]
-H, --header LINE Custom header to pass to server (H) 自定义头信息传递给服务器
-I, --head Show document info only 只显示头部信息
-h, --help This help text
--hostpubmd5 MD5 Hex encoded MD5 string of the host public key. (SSH)
-0, --http1.0 Use HTTP 1.0 (H) 使用HTTP 1.0
--ignore-content-length Ignore the HTTP Content-Length header 忽略的HTTP头信息的长度
-i, --include Include protocol headers in the output (H/F) 输出时包括protocol头信息
-k, --insecure Allow connections to SSL sites without certs (H) 允许不使用证书到SSL站点
--interface INTERFACE Specify network interface/address to use 使用指定网络接口/地址
-4, --ipv4 Resolve name to IPv4 address 使用IPv4
-6, --ipv6 Resolve name to IPv6 address 使用IPv6
-j, --junk-session-cookies Ignore session cookies read from file (H) 读取文件进忽略session cookie
--keepalive-time SECONDS Interval between keepalive probes
--key KEY Private key file name (SSL/SSH) 私钥文件名 (SSL)
--key-type TYPE Private key file type (DER/PEM/ENG) (SSL) 私钥文件类型 (DER/PEM/ENG) (SSL)
--krb LEVEL Enable Kerberos with specified security level (F)
--libcurl FILE Dump libcurl equivalent code of this command line
--limit-rate RATE Limit transfer speed to this rate 设置传输速度
-l, --list-only List only names of an FTP directory (F) 列出ftp目录下的文件名称
--local-port RANGE Force use of these local port numbers 强制使用本地端口号
-L, --location Follow redirects (H) 如果服务器报告请求的页面已移动到其他位置(用location:header和3xx 响应代码),此选项将使curl在新位置上重新执行请求
--location-trusted like --location and send auth to other hosts (H)
-M, --manual Display the full manual 显示全手动
--mail-from FROM Mail from this address
--mail-rcpt TO Mail to this receiver(s)
--mail-auth AUTH Originator address of the original email
--max-filesize BYTES Maximum file size to download (H/F) 设置最大下载的文件总量
--max-redirs NUM Maximum number of redirects allowed (H) 设置最大读取的目录数
-m, --max-time SECONDS Maximum time allowed for the transfer 设置最大传输时间
--metalink Process given URLs as metalink XML file
--negotiate Use HTTP Negotiate Authentication (H) 使用HTTP身份验证
-n, --netrc Must read .netrc for user name and password 从netrc文件中读取用户名和密码
--netrc-optional Use either .netrc or URL; overrides -n 使用 .netrc 或者 URL来覆盖-n
--netrc-file FILE Set up the netrc filename to use
-N, --no-buffer Disable buffering of the output stream 禁用缓冲输出
--no-keepalive Disable keepalive use on the connection
--no-sessionid Disable SSL session-ID reusing (SSL)
--noproxy List of hosts which do not use proxy
--ntlm Use HTTP NTLM authentication (H) 使用 HTTP NTLM 身份验证
-o, --output FILE Write output to <file> instead of stdout 把输出写到该文件中
--pass PASS Pass phrase for the private key (SSL/SSH)
--post301 Do not switch to GET after following a 301 redirect (H)
--post302 Do not switch to GET after following a 302 redirect (H)
--post303 Do not switch to GET after following a 303 redirect (H)
-#, --progress-bar Display transfer progress as a progress bar 用进度条显示当前的传送状态
--proto PROTOCOLS Enable/disable specified protocols
--proto-redir PROTOCOLS Enable/disable specified protocols on redirect
-x, --proxy [PROTOCOL://]HOST[:PORT] Use proxy on given port 在给定的端口上使用HTTP代理
--proxy-anyauth Pick "any" proxy authentication method (H) 选择任一代理身份验证方法
--proxy-basic Use Basic authentication on the proxy (H) 在代理上使用基本身份验证
--proxy-digest Use Digest authentication on the proxy (H) 在代理上使用数字身份验证
--proxy-negotiate Use Negotiate authentication on the proxy (H)
--proxy-ntlm Use NTLM authentication on the proxy (H) 在代理上使用ntlm身份验证
-U, --proxy-user USER[:PASSWORD] Proxy user and password 设置代理用户名和密码
--proxy1.0 HOST[:PORT] Use HTTP/1.0 proxy on given port
-p, --proxytunnel Operate through a HTTP proxy tunnel (using CONNECT) 使用HTTP代理
--pubkey KEY Public key file name (SSH)
-Q, --quote CMD Send command(s) to server before transfer (F/SFTP) 文件传输前,发送命令到服务器
--random-file FILE File for reading random data from (SSL)
-r, --range RANGE Retrieve only the bytes within a range 检索来自HTTP/1.1或FTP服务器字节范围
--raw Do HTTP "raw", without any transfer decoding (H)
-e, --referer Referer URL (H) 来源网址
-J, --remote-header-name Use the header-provided filename (H)
-O, --remote-name Write output to a file named as the remote file
--remote-name-all Use the remote file name for all URLs
-R, --remote-time Set the remote file's time on the local output 在本地生成文件时,保留远程文件时间
-X, --request COMMAND Specify request command to use 指定什么命令
--resolve HOST:PORT ADDRESS Force resolve of HOST:PORT to ADDRESS # curl --resolve 36.152.44.132:80 http://www.baidu.com 指定IP地址访问
--retry NUM Retry request NUM times if transient problems occur 传输出现问题时,重试的次数
--retry-delay SECONDS When retrying, wait this many seconds between each 传输出现问题时,设置重试间隔时间
--retry-max-time SECONDS Retry only within this period 传输出现问题时,设置最大重试时间
-S, --show-error Show error. With -s, make curl show errors when they occur 显示错误
-s, --silent Silent mode. Don't output anything 静音模式。不输出任何东西
--socks4 HOST[:PORT] SOCKS4 proxy on given host + port 用socks4代理给定主机和端口
--socks4a HOST[:PORT] SOCKS4a proxy on given host + port
--socks5 HOST[:PORT] SOCKS5 proxy on given host + port 用socks5代理给定主机和端口
--socks5-basic Enable username/password auth for SOCKS5 proxies
--socks5-gssapi Enable GSS-API auth for SOCKS5 proxies
--socks5-hostname HOST[:PORT] SOCKS5 proxy, pass host name to proxy
--socks5-gssapi-service NAME SOCKS5 proxy service name for gssapi
--socks5-gssapi-nec Compatibility with NEC SOCKS5 server
-Y, --speed-limit RATE Stop transfers below speed-limit for 'speed-time' secs 放弃限速所要的时间。默认为30
-y, --speed-time SECONDS Time for trig speed-limit abort. Defaults to 30 停止传输速度的限制,速度时间'秒
--ssl Try SSL/TLS (FTP, IMAP, POP3, SMTP)
--ssl-reqd Require SSL/TLS (FTP, IMAP, POP3, SMTP)
-2, --sslv2 Use SSLv2 (SSL) 使用SSLv2的(SSL)
-3, --sslv3 Use SSLv3 (SSL) 使用的SSLv3(SSL)
--ssl-allow-beast Allow security flaw to improve interop (SSL)
--stderr FILE Where to redirect stderr. - means stdout
--tcp-nodelay Use the TCP_NODELAY option 使用TCP_NODELAY选项
-t, --telnet-option OPT=VAL Set telnet option Telnet选项设置
--tftp-blksize VALUE Set TFTP BLKSIZE option (must be >512)
-z, --time-cond TIME Transfer based on a time condition 传送时间设置
-1, --tlsv1 Use => TLSv1 (SSL) 使用TLSv1(SSL)
--tlsv1.0 Use TLSv1.0 (SSL)
--tlsv1.1 Use TLSv1.1 (SSL)
--tlsv1.2 Use TLSv1.2 (SSL)
--tlsv1.3 Use TLSv1.3 (SSL)
--tls-max VERSION Use TLS up to VERSION (SSL)
--trace FILE Write a debug trace to the given file 对指定文件进行debug
--trace-ascii FILE Like --trace but without the hex output 跟踪但没有hex输出
--trace-time Add time stamps to trace/verbose output 跟踪/详细输出时,添加时间戳
--tr-encoding Request compressed transfer encoding (H)
-T, --upload-file FILE Transfer FILE to destination 上传文件
--url URL URL to work with
-B, --use-ascii Use ASCII/text transfer 使用ASCII /文本传输
-u, --user USER[:PASSWORD] Server user and password 设置服务器的用户和密码
--tlsuser USER TLS username
--tlspassword STRING TLS password
--tlsauthtype STRING TLS authentication type (default SRP)
--unix-socket FILE Connect through this UNIX domain socket
-A, --user-agent STRING User-Agent to send to server (H) 设置用户代理发送给服务器
-v, --verbose Make the operation more talkative
-V, --version Show version number and quit 显示版本信息
-w, --write-out FORMAT What to output after completion 什么输出完成后
--xattr Store metadata in extended file attributes
-q If used as the first parameter disables .curlrc
wget 文件下载工具
2.1 启动参数
-V,–version:显示版本号
-h,–help:查看帮助
-b,–background:启动后转入后台执行
2.2 日志记录和输入文件参数
-o,–output-file=file:把记录写到file文件中
-a,–append-output=file:把记录追加到file文件中
-i,–input-file=file:从file读取url来下载
2.3 下载参数
-bind-address=address:指定本地使用地址
-t,-tries=number:设置最大尝试连接次数
-c,-continue:接着下载没有下载完的文件
-O,-output-document=file:将下载内容写入到file文件中
-spider:不下载文件
-T,-timeout=sec:设置响应超时时间
-w,-wait=sec:两次尝试之间间隔时间
–limit-rate=rate:限制下载速率
-progress=type:设置进度条
2.4 目录参数
-P,-directory-prefix=prefix:将文件保存到指定目录
2.5 HTTP参数
-http-user=user:设置http用户名
-http-passwd=pass:设置http密码
-U,–user-agent=agent:伪装代理
-no-http-keep-alive:关闭http活动链接,变成永久链接
-cookies=off:不使用cookies
-load-cookies=file:在开始会话前从file文件加载cookies
-save-cookies=file:在会话结束将cookies保存到file文件
2.6 FTP参数
-passive-ftp:默认值,使用被动模式
-active-ftp:使用主动模式
2.7 递归下载排除参数
-A,–accept=list:分号分割被下载扩展名的列表
-R,–reject=list:分号分割不被下载扩展名的列表
-D,–domains=list:分号分割被下载域的列表
–exclude-domains=list:分号分割不被下载域的列表
-V,–version:显示版本号
-h,–help:查看帮助
-b,–background:启动后转入后台执行
2.2 日志记录和输入文件参数
-o,–output-file=file:把记录写到file文件中
-a,–append-output=file:把记录追加到file文件中
-i,–input-file=file:从file读取url来下载
2.3 下载参数
-bind-address=address:指定本地使用地址
-t,-tries=number:设置最大尝试连接次数
-c,-continue:接着下载没有下载完的文件
-O,-output-document=file:将下载内容写入到file文件中
-spider:不下载文件
-T,-timeout=sec:设置响应超时时间
-w,-wait=sec:两次尝试之间间隔时间
–limit-rate=rate:限制下载速率
-progress=type:设置进度条
2.4 目录参数
-P,-directory-prefix=prefix:将文件保存到指定目录
2.5 HTTP参数
-http-user=user:设置http用户名
-http-passwd=pass:设置http密码
-U,–user-agent=agent:伪装代理
-no-http-keep-alive:关闭http活动链接,变成永久链接
-cookies=off:不使用cookies
-load-cookies=file:在开始会话前从file文件加载cookies
-save-cookies=file:在会话结束将cookies保存到file文件
2.6 FTP参数
-passive-ftp:默认值,使用被动模式
-active-ftp:使用主动模式
2.7 递归下载排除参数
-A,–accept=list:分号分割被下载扩展名的列表
-R,–reject=list:分号分割不被下载扩展名的列表
-D,–domains=list:分号分割被下载域的列表
–exclude-domains=list:分号分割不被下载域的列表