加入收藏 | 设为首页 | 会员中心 | 我要投稿 源码网 (https://www.900php.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Windows > 正文

比man更强悍的命令行工具cheat

发布时间:2019-09-19 14:51:58 所属栏目:Windows 来源:佚名
导读:副标题#e# 经常使用命令行,比如 curl 测试接口响应时间, foriin{1..10};docurl-o/dev/null-s-w$i|time_namelookup:%{time_namelookup}|time_connect:%{time_connect}|time_starttransfer:%{time_starttransfer}|time_total:%{time_total} http://httpbin.

cht.sh

  1. [root@VM_0_14_centos ~]# curl cht.sh/curl 
  2. # Download a single file 
  3. curl http://path.to.the/file 
  4.  
  5. # Download a file and specify a new filename 
  6. curl http://example.com/file.zip -o new_file.zip 
  7.  
  8. # Download multiple files 
  9. curl -O URLOfFirstFile -O URLOfSecondFile 
  10.  
  11. # Download all sequentially numbered files (1-24) 
  12. curl http://example.com/pic[1-24].jpg 
  13.  
  14. # Download a file and follow redirects 
  15. curl -L http://example.com/file 
  16.  
  17. # Download a file and pass HTTP Authentication 
  18. curl -u username:password URL 
  19.  
  20. # Download a file with a Proxy 
  21. curl -x proxysever.server.com:PORT http://addressiwantto.access 
  22.  
  23. # Download a file from FTP 
  24. curl -u username:password -O ftp://example.com/pub/file.zip 
  25.  
  26. # Get an FTP directory listing 
  27. curl ftp://username:password@example.com 
  28.  
  29. # Resume a previously failed download 
  30. curl -C - -o partial_file.zip http://example.com/file.zip 
  31.  
  32. # Fetch only the HTTP headers from a response 
  33. curl -I http://example.com 
  34.  
  35. # Fetch your external IP and network info as JSON 
  36. curl http://ifconfig.me/all/json 
  37.  
  38. # Limit the rate of a download 
  39. curl --limit-rate 1000B -O http://path.to.the/file 
  40.  
  41. # POST to a form 
  42. curl -F "name=user" -F "password=test" http://example.com 
  43.  
  44. # POST JSON Data 
  45. curl -H "Content-Type: application/json" -X POST -d '{"user":"bob","pass":"123"}' http://example.com 
  46.  
  47. # POST data from the standard in / share data on sprunge.us 
  48. curl -F 'sprunge=<-' sprunge.us 

看看Python的requests怎么用

  1. [root@VM_0_14_centos ~]# curl cheat.sh/python/requests 
  2. #  python-requests: Limit Number of Redirects Followed 
  3. #  You have to create Session (http://www.python- 
  4. #  requests.org/en/latest/api/requests.Session) object and set 
  5. #  max_redirects variable to 3 
  6.  
  7. session = requests.Session() 
  8. session.max_redirects = 3 
  9. session.get(url) 
  10.  
  11. #  TooManyRedirects exception will be raised if a requests exceeds 
  12. #  maximum number of redirects. 
  13. #  Related github issue discussing why you can not set max_redirects per 
  14. #  request https://github.com/kennethreitz/requests/issues/1300 
  15. #  [Alik] [so/q/31552627] [cc by-sa 3.0] 

它也有网页版 http://cht.sh/curl

比man更强悍的命令行工具cheat

有了tldr和cheat,再也不用记那么多命令行参数了。

win下执行命令行的工具我常用cmder,如果你用的win10,可以尝试下微软最新发布的Terminal https://github.com/microsoft/Terminal

【责任编辑:庞桂玉 TEL:(010)68476606】
点赞 0

(编辑:源码网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读