write-out.d 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. Long: write-out
  2. Short: w
  3. Arg: <format>
  4. Help: Use output FORMAT after completion
  5. Category: verbose
  6. ---
  7. Make curl display information on stdout after a completed transfer. The format
  8. is a string that may contain plain text mixed with any number of
  9. variables. The format can be specified as a literal "string", or you can have
  10. curl read the format from a file with "@filename" and to tell curl to read the
  11. format from stdin you write "@-".
  12. The variables present in the output format will be substituted by the value or
  13. text that curl thinks fit, as described below. All variables are specified as
  14. %{variable_name} and to output a normal % you just write them as %%. You can
  15. output a newline by using \\n, a carriage return with \\r and a tab space with
  16. \\t.
  17. The output will be written to standard output, but this can be switched to
  18. standard error by using %{stderr}.
  19. .B NOTE:
  20. The %-symbol is a special symbol in the win32-environment, where all
  21. occurrences of % must be doubled when using this option.
  22. The variables available are:
  23. .RS
  24. .TP 15
  25. .B content_type
  26. The Content-Type of the requested document, if there was any.
  27. .TP
  28. .B errormsg
  29. The error message. (Added in 7.75.0)
  30. .TP
  31. .B exitcode
  32. The numerical exitcode. (Added in 7.75.0)
  33. .TP
  34. .B filename_effective
  35. The ultimate filename that curl writes out to. This is only meaningful if curl
  36. is told to write to a file with the --remote-name or --output
  37. option. It's most useful in combination with the --remote-header-name
  38. option. (Added in 7.26.0)
  39. .TP
  40. .B ftp_entry_path
  41. The initial path curl ended up in when logging on to the remote FTP
  42. server. (Added in 7.15.4)
  43. .TP
  44. .B http_code
  45. The numerical response code that was found in the last retrieved HTTP(S) or
  46. FTP(s) transfer. In 7.18.2 the alias \fBresponse_code\fP was added to show the
  47. same info.
  48. .TP
  49. .B http_connect
  50. The numerical code that was found in the last response (from a proxy) to a
  51. curl CONNECT request. (Added in 7.12.4)
  52. .TP
  53. .B http_version
  54. The http version that was effectively used. (Added in 7.50.0)
  55. .TP
  56. .B json
  57. A JSON object with all available keys.
  58. .TP
  59. .B local_ip
  60. The IP address of the local end of the most recently done connection - can be
  61. either IPv4 or IPv6 (Added in 7.29.0)
  62. .TP
  63. .B local_port
  64. The local port number of the most recently done connection (Added in 7.29.0)
  65. .TP
  66. .B method
  67. The http method used in the most recent HTTP request (Added in 7.72.0)
  68. .TP
  69. .B num_connects
  70. Number of new connects made in the recent transfer. (Added in 7.12.3)
  71. .TP
  72. .B num_headers
  73. The number of response headers in the most recent request (restarted at each
  74. redirect). Note that the status line IS NOT a header. (Added in 7.73.0)
  75. .TP
  76. .B num_redirects
  77. Number of redirects that were followed in the request. (Added in 7.12.3)
  78. .TP
  79. .B onerror
  80. The rest of the output is only shown if the transfer returned a non-zero error
  81. (Added in 7.75.0)
  82. .TP
  83. .B proxy_ssl_verify_result
  84. The result of the HTTPS proxy's SSL peer certificate verification that was
  85. requested. 0 means the verification was successful. (Added in 7.52.0)
  86. .TP
  87. .B redirect_url
  88. When an HTTP request was made without --location to follow redirects (or when
  89. --max-redir is met), this variable will show the actual URL a redirect
  90. \fIwould\fP have gone to. (Added in 7.18.2)
  91. .TP
  92. .B remote_ip
  93. The remote IP address of the most recently done connection - can be either
  94. IPv4 or IPv6 (Added in 7.29.0)
  95. .TP
  96. .B remote_port
  97. The remote port number of the most recently done connection (Added in 7.29.0)
  98. .TP
  99. .B response_code
  100. The numerical response code that was found in the last transfer (formerly
  101. known as "http_code"). (Added in 7.18.2)
  102. .TP
  103. .B scheme
  104. The URL scheme (sometimes called protocol) that was effectively used (Added in 7.52.0)
  105. .TP
  106. .B size_download
  107. The total amount of bytes that were downloaded.
  108. .TP
  109. .B size_header
  110. The total amount of bytes of the downloaded headers.
  111. .TP
  112. .B size_request
  113. The total amount of bytes that were sent in the HTTP request.
  114. .TP
  115. .B size_upload
  116. The total amount of bytes that were uploaded.
  117. .TP
  118. .B speed_download
  119. The average download speed that curl measured for the complete download. Bytes
  120. per second.
  121. .TP
  122. .B speed_upload
  123. The average upload speed that curl measured for the complete upload. Bytes per
  124. second.
  125. .TP
  126. .B ssl_verify_result
  127. The result of the SSL peer certificate verification that was requested. 0
  128. means the verification was successful. (Added in 7.19.0)
  129. .TP
  130. .B stderr
  131. From this point on, the --write-out output will be written to standard
  132. error. (Added in 7.63.0)
  133. .TP
  134. .B stdout
  135. From this point on, the --write-out output will be written to standard output.
  136. This is the default, but can be used to switch back after switching to stderr.
  137. (Added in 7.63.0)
  138. .TP
  139. .B time_appconnect
  140. The time, in seconds, it took from the start until the SSL/SSH/etc
  141. connect/handshake to the remote host was completed. (Added in 7.19.0)
  142. .TP
  143. .B time_connect
  144. The time, in seconds, it took from the start until the TCP connect to the
  145. remote host (or proxy) was completed.
  146. .TP
  147. .B time_namelookup
  148. The time, in seconds, it took from the start until the name resolving was
  149. completed.
  150. .TP
  151. .B time_pretransfer
  152. The time, in seconds, it took from the start until the file transfer was just
  153. about to begin. This includes all pre-transfer commands and negotiations that
  154. are specific to the particular protocol(s) involved.
  155. .TP
  156. .B time_redirect
  157. The time, in seconds, it took for all redirection steps including name lookup,
  158. connect, pretransfer and transfer before the final transaction was
  159. started. time_redirect shows the complete execution time for multiple
  160. redirections. (Added in 7.12.3)
  161. .TP
  162. .B time_starttransfer
  163. The time, in seconds, it took from the start until the first byte was just
  164. about to be transferred. This includes time_pretransfer and also the time the
  165. server needed to calculate the result.
  166. .TP
  167. .B time_total
  168. The total time, in seconds, that the full operation lasted.
  169. .TP
  170. .B url
  171. The URL that was fetched. (Added in 7.75.0)
  172. .TP
  173. .B urlnum
  174. The URL index number of this transfer, 0-indexed. (Added in 7.75.0)
  175. .TP
  176. .B url_effective
  177. The URL that was fetched last. This is most meaningful if you've told curl
  178. to follow location: headers.
  179. .RE
  180. .IP
  181. If this option is used several times, the last one will be used.