Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

curl -D- option

Tags:

bash

curl

I was reading the JIRA REST API tutorial and in their example curl request, they show

curl -D- -u username:password <rest-of-request>

What is the -D- syntax with the dash before and after?

like image 902
Jeff Storey Avatar asked Jul 28 '26 09:07

Jeff Storey


1 Answers

To quote man curl:

  -D, --dump-header <file>
          Write the protocol headers to the specified file.

          This  option is handy to use when you want to store
          the headers that a HTTP site sends to you. C

After a -D you normally give the name of the file where you want to dump the headers. As with many utilities, - is recognized as an alias to stdout.
(if you're not familiar with that concept: when you launch the command from a terminal without redirection, stdout is the "terminal screen")

The -D- (without space) form is exactly the same as -D - (or on Linux at least, -D /dev/stdout)

like image 197
Sylvain Leroux Avatar answered Jul 30 '26 02:07

Sylvain Leroux