Curl 常用commands

经常利用curl 来测试网站的一些301/302转向,检查代码什么的.

下面是常用的命令, 这里保存一下,经常用的上. 

curl -o vue-v2.6.10.js https://cdn.jsdelivr.net/npm/vue/dist/vue.js 
#vue.js 保存为vue-v2.6.10.js
curl -O https://cdn.jsdelivr.net/npm/vue/dist/vue.js  
# -O 直接保存为原文件名
curl -I  https://www.ubuntu.com/  
# 获得HTTP HEADER
curl -I --http2 https://www.ubuntu.com 
# --https2 检查是否支持http2协议
curl -L google 
# -L 命令curl 跟随跳转到final destination
curl -A "googlebot" https://www.ubuntu.com 
# -A 自定义UA
curl -x 192.168.66.1:8888 http://linux 
# -x 或者 --proxy 设定proxy
curl -H "X-Header: value" https://www.keycdn.com 
# -H 自定义header
curl -H "X-Header: value" https://www.keycdn.com -v 
# -v 表示 verbose
curl -h # -h 表示manual
curl --request GET/POST https://www.keycdn.com  
# curl 默认是GET, --request 可以自定为GET或者POST

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.