Skip to content

Instantly share code, notes, and snippets.

@Ivlyth
Last active December 13, 2017 03:46
Show Gist options
  • Save Ivlyth/1ddac149d50c667b1b07 to your computer and use it in GitHub Desktop.
Save Ivlyth/1ddac149d50c667b1b07 to your computer and use it in GitHub Desktop.
curl 命令记录

该gist主要用来记录curl相关的一些有用命令

curl -o /dev/null -w "time_namelookup: %{time_namelookup}\ntime_appconnect: %{time_appconnect}\ntime_connect: %{time_connect}\ntime_redirect: %{time_redirect}\ntime_pretransfer: %{time_pretransfer}\ntime_starttransfer: %{time_starttransfer}\ntime_total: %{time_total}\n" -s TEST_URL

在linux下, 可以保存一个快捷命令

编辑~/.bash_alias文件, 添加如下一行
alias curltime="curl -o /dev/null -w \"time_namelookup:      %{time_namelookup}\ntime_appconnect:      %{time_appconnect}\ntime_connect:         %{time_connect}\ntime_redirect:        %{time_redirect}\ntime_pretransfer:     %{time_pretransfer}\ntime_starttransfer:   %{time_starttransfer}\ntime_total:           %{time_total}\n\" -s"

打开新的shell命令窗口, 就可以使用了

myth@myth:~$ curltime http://c.myth.ren/1/1.txt
time_namelookup:      0.509
time_appconnect:      0.000
time_connect:         0.547
time_redirect:        0.000
time_pretransfer:     0.547
time_starttransfer:   0.585
time_total:           0.585
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment