wiki/notebook/cli.curl.org
Gabriel Arazas b088086b06 Merge evergreen notes into the notebook
Now, it's all under the notebook umbrella. Seems to be appropriate as it
is just my notes after all.

I also updated some notes from there. I didn't keep track of what it is
this time. Something about more learning notes extracted from my
"Learning how to learn" course notes and then some. Lack of time and
hurriness just makes it difficult to track but it should be under
version control already.
2021-07-21 16:28:07 +08:00

1.8 KiB

Command line: cURL

The all-time favorite client-side networking tool for basic stuff. It 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.

Synopsis

curl [option...] [URL...]

cURL supports creating requests with different protocols. Among them are HTTP, Gopher, DICT, and simple file. To see more, you can view the cURL manual page (i.e., man curl.1) and see the protocols section.

Options

  • -o [FILE], --output [FILE] - save the results in the given file
  • -O, --remote-name - save the results as the remote name; useful for downloading
  • -L, --location - if there redirects, follow them; mainly used in HTTP

Examples

This is a massive tool with a massive history so a massive list may be justified for this one.

Basic usage

# It will be recognized as a request to an HTTP endpoint in 'gnu.org'.
curl https://gnu.org

# Save the result in a file.
curl https://foo-dogsquared.github.io --output filename

Go-to command for downloading files with cURL

curl -LO https://cdn.media.ccc.de/events/lac/lac18/h264-hd/lac18-24-eng-Carla_Plugin_Host_-_Feature_overview_and_workflows_hd.mp4

It can be also written like the following code block. Useful when scripting to make it readable.

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