{"pageProps":{"metadata":{"date":"\"2021-06-04 10:56:52 +08:00\"","date_modified":"\"2021-10-24 22:02:49 +08:00\"","language":"en","source":""},"title":"Command line: cURL","hast":{"type":"root","children":[{"type":"element","tagName":"nav","properties":{"className":"toc"},"children":[{"type":"element","tagName":"ol","properties":{"className":"toc-level toc-level-1"},"children":[{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h1","properties":{"id":"synopsis"},"children":[{"type":"text","value":"Synopsis"}]}]},"properties":{"className":"toc-item toc-item-h1"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h1","href":"/cli.curl#synopsis"},"children":[{"type":"text","value":"Synopsis"}]}]},{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h1","properties":{"id":"options"},"children":[{"type":"text","value":"Options"}]}]},"properties":{"className":"toc-item toc-item-h1"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h1","href":"/cli.curl#options"},"children":[{"type":"text","value":"Options"}]}]},{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h1","properties":{"id":"examples"},"children":[{"type":"text","value":"Examples"}]}]},"properties":{"className":"toc-item toc-item-h1"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h1","href":"/cli.curl#examples"},"children":[{"type":"text","value":"Examples"}]},{"type":"element","tagName":"ol","properties":{"className":"toc-level toc-level-2"},"children":[{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h2","properties":{"id":"basic-usage"},"children":[{"type":"text","value":"Basic usage"}]}]},"properties":{"className":"toc-item toc-item-h2"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h2","href":"/cli.curl#basic-usage"},"children":[{"type":"text","value":"Basic usage"}]}]},{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h2","properties":{"id":"go-to-command-for-downloading-files-with-curl"},"children":[{"type":"text","value":"Go-to command for downloading files with cURL"}]}]},"properties":{"className":"toc-item toc-item-h2"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h2","href":"/cli.curl#go-to-command-for-downloading-files-with-curl"},"children":[{"type":"text","value":"Go-to command for downloading files with cURL"}]}]}]}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The all-time favorite client-side networking tool for basic stuff.\nIt is seriously one of the best free and open-source tool out there with the plethora of protocols, leading implementation for various protocols such as HTTP3, and a lot of configurable options to fully control your request.\n"}]},{"type":"element","tagName":"h1","properties":{"id":"synopsis"},"children":[{"type":"text","value":"Synopsis"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"curl [option...] [URL...]\n"}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"cURL supports creating requests with different protocols.\nAmong them are HTTP, Gopher, DICT, and simple file.\nTo see more, you can view the cURL manual page (i.e., "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"man curl.1"}]},{"type":"text","value":") and see the protocols section.\n"}]},{"type":"element","tagName":"h1","properties":{"id":"options"},"children":[{"type":"text","value":"Options"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-o [FILE], --output [FILE]"}]},{"type":"text","value":" - save the results in the given file\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-O, --remote-name"}]},{"type":"text","value":" - save the results as the remote name; useful for downloading\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"-L, --location"}]},{"type":"text","value":" - if there redirects, follow them; mainly used in HTTP and download links that often redirects to the real location\n"}]}]}]},{"type":"element","tagName":"h1","properties":{"id":"examples"},"children":[{"type":"text","value":"Examples"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"This is a massive tool with a massive history so a massive list may be justified for this one.\n"}]},{"type":"element","tagName":"h2","properties":{"id":"basic-usage"},"children":[{"type":"text","value":"Basic usage"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-bash"]},"children":[{"type":"text","value":"# It will be recognized as a request to an HTTP endpoint in 'gnu.org'.\ncurl https://gnu.org\n\n# Save the result in a file.\ncurl https://foo-dogsquared.github.io --output filename\n"}]}]},{"type":"element","tagName":"h2","properties":{"id":"go-to-command-for-downloading-files-with-curl"},"children":[{"type":"text","value":"Go-to command for downloading files with cURL"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-bash"]},"children":[{"type":"text","value":"curl -LO https://cdn.media.ccc.de/events/lac/lac18/h264-hd/lac18-24-eng-Carla_Plugin_Host_-_Feature_overview_and_workflows_hd.mp4\n"}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"It can be also written like the following code block.\nUseful when scripting to make it readable.\n"}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-bash"]},"children":[{"type":"text","value":"curl --location --output-name https://cdn.media.ccc.de/events/lac/lac18/h264-hd/lac18-24-eng-Carla_Plugin_Host_-_Feature_overview_and_workflows_hd.mp4\n"}]}]}]},"backlinks":[]},"__N_SSG":true}