↓Skip to main content

Curl Commands

296 words·
Linux curl Commands
Table of Contents

Main Commands
#

# Curl -v
curl -v http://google.com

# Shell output:
* Host google.com:80 was resolved.
* IPv6: 2a00:1450:4014:801::200e
* IPv4: 142.251.141.174
*   Trying [2a00:1450:4014:801::200e]:80...
*   Trying 142.251.141.174:80...
* Established connection to google.com (142.251.141.174 port 80) from 10.0.150.100 port 36898 
* using HTTP/1.x
> GET / HTTP/1.1
> Host: google.com
> User-Agent: curl/8.18.0
> Accept: */*
> 
* Request completely sent off
< HTTP/1.1 301 Moved Permanently
< Location: http://www.google.com/
< Content-Type: text/html; charset=UTF-8
< Content-Security-Policy-Report-Only: object-src 'none';base-uri 'self';script-src 'nonce-nQParuXznrsxDbGUWy-UeA' 'strict-dynamic' 'report-sample' 'unsafe-eval' 'unsafe-inline' https: http:;report-uri https://csp.withgoogle.com/csp/gws/other-hp
< Date: Tue, 27 Oct 2026 18:26:50 GMT
< Expires: Thu, 26 Nov 2026 18:26:50 GMT
< Cache-Control: public, max-age=2592000
< Server: gws
< Content-Length: 219
< X-XSS-Protection: 0
< X-Frame-Options: SAMEORIGIN
< 
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
* Connection #0 to host google.com:80 left intact
  • curl -v Verbose

  • curl -I Status code, response headers, no response body

  • curl -L Follow redirection

  • curl -s Silent, suppress progress meter and errors

  • curl -o response.html http://example.com Write response body to a file


Download File
#

# Download file
curl -fLO https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.164.0/otelcol-k8s_0.164.0_linux_amd64.tar.gz

# Shell output:
  % Total    % Received % Xferd  Average Speed  Time    Time    Time   Current
                                 Dload  Upload  Total   Spent   Left   Speed
  0      0   0      0   0      0      0      0                              0
100 48.87M 100 48.87M   0      0 18.13M      0   00:02   00:02         19.45M
  • -f Fail on HTTP errors
  • -L Follow redirects
  • -O Use the filename from the URL
# Download file, output stats for troubleshooting
curl -L \
  --fail \
  --output otelcol-k8s_0.164.0_linux_amd64.tar.gz \
  --progress-bar \
  --write-out '\nHTTP status: %{http_code}\nCurl exit code: %{exitcode}\nError: %{errormsg}\nDuration: %{time_total}s\nDownloaded: %{size_download} bytes\nAverage speed: %{speed_download} bytes/s\n' \
  "https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.164.0/otelcol-k8s_0.164.0_linux_amd64.tar.gz"

# Shell output:
100.0%

HTTP status: 200
Curl exit code: 0
Error: 
Duration: 0.920560s
Downloaded: 51244515 bytes
Average speed: 55666675 bytes/s