How to get response headers with cURL Command

To see curl response headers, we need to use curl -I (Uppercase i) option.

curl -I

To get curl response headers to a file, use the -D option or --dump-header option.

curl --dump-header headers.txt


curl -D headers.txt

As per the above example, response headers will be saved to the 'headers.txt' file.