🚀 We are hiring! See open positions

How To Download a File With cURL?

by mazen Mar 13, 2024

To download a file with cURL, we can use the -O option. Let's attempt to download a PDF file on web-scraping.dev with cURL:

curl -O https://web-scraping.dev/assets/pdf/eula.pdf

The above command will result in the following output and save the file to the same directory of the opened terminal:

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 10287  100 10287    0     0  10769      0 --:--:-- --:--:-- --:--:-- 10783

Next, let's download a file with cURL to a specific folder location with the --output-dir cURL option:

curl --create-dirs -O --output-dir /eula/pdfs https://web-scraping.dev/assets/pdf/eula.pdf

The above cURL command will download the PDf file and save it to the /eula/pdfs directory. For further details on cURL, refer to our dedicated guide.

Related Articles