
In situations like this to emulate a different browser, use the -A option.įor example to emulates Firefox 60 you would use: curl -A "Mozilla/5.0 (X11 Linux x86_64 rv:60.0) Gecko/20100101 Firefox/60.0" Specify a Maximum Transfer Rate # Sometimes when downloading a file, the remote server may be set to block the Curl User-Agent or to return different contents depending on the visitor device and browser. The -L option instructs curl to follow any redirect until it reaches the final destination: curl -L Change the User-Agent # Use the -I option to fetch only the HTTP headers of the specified resource: curl -I -http2

Headers are passed between the client and the server with the request or the response.

HTTP headers are colon-separated key-value pairs containing information such as user agent, content type, and encoding. This is useful if your connection drops during the download of a large file, and instead of starting the download from scratch, you can continue the previous one.įor example, if you are downloading the Ubuntu 18.04 iso file using the following command: curl -O Īnd suddenly your connection drops you can resume the download with: curl -C -O Get the HTTP Headers of a URL # You can resume a download by using the -C - option. In the following example we are downloading the Arch Linux and Debian iso files: curl -O \ -O Resume a Download #

To download multiple files at once, use multiple -O options, followed by the URL to the file you want to download. Uppercase -O saves the file with its original filename: curl -O Download Multiple files # Lowercase -o saves the file with a predefined filename, which in the example below is vue-v2.6.10.js: curl -o vue-v2.6.10.js To save the result of the curl command, use either the -o or -O option. If no protocol is specified, curl tries to guess the protocol you want to use, and it will default to HTTP. The command will print the source code of the homepage in your terminal window. The source from github is missing the configure exec.In its simplest form, when invoked without any option, curl displays the specified resource to the standard output.įor example, to retrieve the homepage you would run: curl configure: No such file or directory issue after getting the curl source from github.

For anyone that stumbles upon this in 2021 and later using Xcode 12+ attempting to build their project via commandline and doesn't want to rely on 'brew' or other package managers.
