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