which vim
cd /usr/bin/
vim curltime
#!/bin/bash
curl -w @- -o /dev/null -s "$@" <<'EOF'
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_pretransfer: %{time_pretransfer}\n
time_redirect: %{time_redirect}\n
time_starttransfer: %{time_starttransfer}\n
----------\n
time_total: %{time_total}\n
EOF
chmod 777 curltime
Step 5) All set. Test the command, instead of using 'curl' use 'curltime', if you called the file differently, then use the name you gave it in order to invoke the script:
curltime google.com
See the example step by step:
Note: You can also include more filters in order to increase verbosity and enrich the output upon need, examples below,
curltime https://google.com:443 --trace-time -v -o /dev/null
router/e6f2a67d-bc87-49ba-a458-e524f2d646b6:/# curltime https://google.com:443 --trace-time -v -o /dev/null 19:36:54.461685 * Trying 142.251.46.206:443... 19:36:54.491708 * Connected to google.com (142.251.46.206) port 443 (#0) 19:36:54.497072 * ALPN, offering h2 19:36:54.497176 * ALPN, offering http/1.1 19:36:54.584906 * CAfile: /etc/ssl/certs/ca-certificates.crt 19:36:54.584982 * CApath: /etc/ssl/certs ------------------- 19:36:55.038710 * TLSv1.2 (IN), TLS header, Supplemental data (23): 19:36:55.038919 { [5 bytes data] 19:36:55.039595 * Connection #0 to host google.com left intact time_namelookup: 0.001086 time_connect: 0.031088 time_appconnect: 0.181960 time_pretransfer: 0.182862 time_redirect: 0.000000 time_starttransfer: 0.576149 ---------- time_total: 0.579023