55

I am looking at an example of a curl command that uses the @ symbol before the filename to post data to the server.

curl http://localhost/ --data-binary @file.txt

What does this mean? Does it insert the contents of the file into the command? Is it specific to curl?

1 Answer 1

59

It is specific to curl. From man curl:

--data-binary <data>
  (HTTP) This posts data exactly as specified with no extra processing whatsoever.
  If you start the data with the letter @, the rest should be a filename.  Data is
  posted in a similar manner as --data-ascii does, except that newlines are preserved
  and conversions are never done.

  If this option is used several times, the ones following the first will append data
  as described in -d, --data.
2
  • 4
    I should have looked there. I was expecting it to be a shell thing though. Thanks a million. Commented Jul 14, 2014 at 14:55
  • 1
    If you came here to learn about the @: it has multiple uses. Not just for --data-binary. Check the man-page.
    – Chris
    Commented Apr 1, 2022 at 14:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .