Curl output format

A lot of usefull informatoin can be caught using curl. Formating the output can be done with the -w --write-out argument

curl -w 'Home loadtime: %{time_total}nResponse code: %{http_code}n' -o /dev/null -s 'https://janw.me/'
Bash output of curl request

Output example:

This example will show the load time and response code. These 2 values are duable. But If you want more it’s more readable to pass a file.

In file: nano curlformat.txt

    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

Then pass the file to curl:

curl -w "@curl-format.txt" -o /dev/null -s "https://janw.me/"
Bash output of curl format file

A list of all avialable variables are in the man pages

Sources: