How do you print received cookie info to stdout with curl?

Remove the "-c"

curl --cookie-jar - 'http://google.com'

Also you try verbose mode and see the cookie headers:

curl -v 'http://google.com'

You can save the cookies received and send them back to the server using the following commands:

1) To get/save the cookies to file "/tmp/cookies.txt":

curl -c /tmp/cookies.txt http://the.site.with.cookies/

2) To send the cookies back to the server (again using file "/tmp/cookies.txt"):

curl -b /tmp/cookies.txt http://the.site.with.cookies/

I hope it was useful.

[]s Ronaldo


You get that error because you use in the wrong way that option. When you see in a man page an option like:

-c, --cookie-jar <file name>

this mean that if you want to use that option, you must to use -c OR --cookie-jar, never both! These two are equivalent and, in fact, -c is the abbreviated form for --cookie-jar. There are many, many options in man pages which are designed in the same way.

In your case:

curl -c - 'http://google.com'

--cookie-jar is given as argument for -c option, so, it's interpreted as a file name, not like an option (as you may think), and - remains alone which leads to error because curl, indeed, doesn't have such an option.