-I gives you only the headers, and -i mixes them into the body. -D does a normal download and writes the headers to a file of their own.
Give -D a file name:
curl -sL -D headers.txt -o page.html https://example.com/
cat headers.txt
The page lands in page.html untouched, and headers.txt holds the status line and every header. With -L you get the headers of each hop in the redirect chain, one block after the other, which is a nice record of how you got there.
Use -D - to print the headers on standard output while the body still goes to a file. I like that for a quick look at caching headers on a real GET, because some servers answer a HEAD request from -I differently than a GET.
curl -s -D - -o /dev/null https://example.com/ | grep -i '^cache-control'
Header lines end with a carriage return and a newline, as HTTP sends them. That trips up scripts: a value you cut out with grep still carries the \r, and a comparison like [ "$x" = "no-cache" ] fails for no visible reason. Pipe through tr -d '\r' first. The file is overwritten on every run unless you choose another name.
Further reading: curl man page