Show only the response headers
Show only the response headers with curl, either by sending a HEAD request or by dumping the headers of a real GET with -D - and dropping the body.
You need the response headers of a URL, and there are two ways to get them that are not equivalent.
curl -sI http://127.0.0.1:8000/index.txt | grep -E '^(HTTP|Content-)'
echo ---
curl -s -D - -o /dev/null http://127.0.0.1:8000/index.txt | grep -E '^(HTTP|Content-)'HTTP/1.0 200 OK
Content-type: text/plain
Content-Length: 6
---
HTTP/1.0 200 OK
Content-type: text/plain
Content-Length: 6-I changes the method to HEAD, so the server sends headers and no body. -D - writes the received headers to standard output while the normal GET goes ahead and -o /dev/null throws the body away. Both are in the curl manual. The output of the two runs is the same here, because this server answers HEAD and GET alike.
A server is allowed to answer HEAD differently, and many frameworks route it to a different handler or return 405 for it. If the headers of a real request matter, as in a cache or a content-length check, use -D - instead of -I.