Curl for Fast Diagnostics
Sometimes, working tech support for shared web hosting, using a web browser is clunky to see what is really going on. curl is the best choice when I need to see exactly what a server is responding with. Here are the commands I use on a regular basis.
| curl http://www.programmerq.net/ | See the URL, no output if a redirect, no headers |
| curl -i http://www.programmerq.net/ | See the URL with headers |
| curl -I http://www.programmerq.net/ | See only the headers |
| curl -L http://www.programmerq.net/ | See the URL, if it redirects, show the final destination URL |
| curl -iL http://www.programmerq.net/ | See the URL, show headers for each redirected location, show final destination URL |
| curl -d "name=value" http://www.programmerq.net/ | post a form value to url; can repeat option for multiple values |
| curl -b cookies.txt http://www.programmerq.net/ | read cookie data from "cookies.txt" |
| curl -c cookies.txt http://www.programmerq.net/ | write cookie data to "cookies.txt" |
| curl -b cookies.txt -c cookies.txt http://www.programmerq.net/ | read cookie data from and write cookie data to "cookies.txt" |
| curl -u <username> http://www.programmerq.net/ | use username when making the request, password is prompted on command line |
| watch "curl -s http://www.programmerq.net/" | repeat the curl command without spewing speed information |