cURL provides multiple output control parameters for controlling the verbosity and format of requests. Understanding the differences between these parameters is important for debugging and daily use.
Parameter Comparison
| Parameter | Full Name | Purpose | Output Content |
|---|---|---|---|
-v | --verbose | Verbose mode | Complete request/response info |
-i | --include | Include headers | Headers + Body |
-I | --head | Headers only | Headers only (HEAD request) |
-s | --silent | Silent mode | Body only (no progress) |
-S | --show-error | Show errors | Use with -s |
Detailed Explanation and Examples
1. -v (verbose) Verbose Mode
bash# Show complete request and response process curl -v https://api.example.com # Output example: # * Trying 192.168.1.1:443... # * Connected to api.example.com (192.168.1.1) port 443 (#0) # > GET / HTTP/1.1 # > Host: api.example.com # > User-Agent: curl/7.68.0 # > Accept: */* # > # * Mark bundle as not supporting multiuse # < HTTP/1.1 200 OK # < Content-Type: application/json # < Content-Length: 123 # < # {"status":"ok","data":[]} # * Connection #0 to host api.example.com left intact
Output symbols:
*- Connection and protocol info>- Sent request data<- Received response data{or}- SSL/TLS handshake info
2. -i (include) Include Headers
bash# Show response headers and body curl -i https://api.example.com # Output example: # HTTP/1.1 200 OK # Content-Type: application/json # Content-Length: 123 # Date: Mon, 01 Mar 2026 10:00:00 GMT # # {"status":"ok","data":[]}
3. -I (head) Headers Only
bash# Send HEAD request, get headers only curl -I https://api.example.com # Output example: # HTTP/1.1 200 OK # Content-Type: application/json # Content-Length: 123 # Date: Mon, 01 Mar 2026 10:00:00 GMT # Last-Modified: Sun, 28 Feb 2026 08:00:00 GMT # ETag: "abc123" # Cache-Control: max-age=3600
Note: -I automatically sends HEAD request, no body is retrieved.
4. -s (silent) Silent Mode
bash# Silent mode, no progress info curl -s https://api.example.com # Only output body content # {"status":"ok","data":[]} # Combine with -S to show errors curl -s -S https://api.example.com # Combine with -o to output to file curl -s https://api.example.com -o output.json
Combined Usage
bash# Silent + show errors curl -s -S https://api.example.com # Verbose + output to file curl -v https://api.example.com -o output.json 2>debug.log # Include headers + silent curl -i -s https://api.example.com # Headers only + format curl -I -s https://api.example.com | grep -i content-type
Practical Scenarios
Scenario 1: API Debugging
bash# View complete request/response process curl -v -X POST https://api.example.com/users \ -H "Content-Type: application/json" \ -d '{"name":"test"}'
Scenario 2: Check Response Headers
bash# Check cache headers curl -I -s https://cdn.example.com/image.jpg | grep -i cache # Check Content-Type curl -I -s https://api.example.com/data | grep -i content-type
Scenario 3: Use in Scripts
bash# Silent data retrieval and parsing response=$(curl -s https://api.example.com/users) echo "$response" | jq '.[] | .name' # Check HTTP status code status=$(curl -s -o /dev/null -w "%{http_code}" https://api.example.com) if [ "$status" = "200" ]; then echo "OK" else echo "Error: $status" fi
Scenario 4: Debug SSL Issues
bash# View SSL handshake process curl -v https://api.example.com 2>&1 | grep -E "(SSL|TLS|certificate)" # Save verbose log for analysis curl -v https://api.example.com 2>ssl-debug.log
Other Related Parameters
bash# --trace-ascii save detailed trace info curl --trace-ascii debug.txt https://api.example.com # --trace-time add timestamps curl -v --trace-time https://api.example.com # -w custom output format curl -s -o /dev/null -w "Status: %{http_code}\nTime: %{time_total}s\n" https://api.example.com # --progress-bar show progress bar curl --progress-bar -O https://example.com/large-file.zip
Summary Recommendations
| Scenario | Recommended Parameters |
|---|---|
| Daily debugging | -v |
| View response headers | -I or -i |
| Use in scripts | -s or -s -S |
| Performance testing | -s -o /dev/null -w ... |
| Download files | -s -O or --progress-bar |