How to download a file using curl command

October 17, 2023 / How-to Guide

This article explains how to download a file using curl command. The curl command is a versatile command-line tool used to transfer data to or from a server.

Follow the steps-

  1. Retrieve the file using curl run-
    $ curl https://your-domain/file.pdf
  2. Get file using ftp or sftp protocol-
    $ curl ftp://ftp-your-domain-name/file.tar.gz
  3. While using curl to download a file, you can specify the desired output file name by running-
    $ curl -o file.pdf https://your-domain-name/long-file-name.pdf
  4. To follow a 301-redirected file during a file download using curl, use the following command-
    $ curl -L -o file.tgz http://www.cyberciti.biz/long.file.name.tgz

This way, you can download a file using curl command. If you face any difficulty while executing these commands, you can seek help from our experts at any time.

Dominos Search