How to Download a File Using curl Command

curl is a powerful command-line tool for transferring data using various protocols like HTTP, HTTPS, FTP, and SFTP. It supports downloading files efficiently.

Basic file download: curl -O https://example.com/file.zip

The -O flag saves the file with its original name.

Common useful options:

  1. Specify output filename: curl -o custom_name.zip https://example.com/file.zip
  2. Resume interrupted download: curl -C – -O https://example.com/file.zip
  3. Show download progress: curl -# -O https://example.com/file.zip
  4. Follow redirects: curl -L -O https://example.com/file.zip
  5. Download with authentication: curl -u username:password -O https://example.com/file.zip
  6. Download silently (no progress): curl -s -O https://example.com/file.zip
  7. Download with a specific user-agent: curl -A “Mozilla/5.0” -O https://example.com/file.zip

Additional tips:

Use -k to allow insecure connections (not recommended)
Add -v for verbose output to debug issues
Combine with –limit-rate to control download speed (e.g., –limit-rate 1M)

Now you know a bit about using curl to download files from a URL.

Learn how to install cURL on Windows and Linux to streamline data transfers. A must-have tool for developers and system administrators!

Popular Posts You May Read

Explore more hosting insights, tips and industry updates.

Hyper-v Hosting FAQs

What is a Hyper-V Server? Microsoft Hyper V Server 2008 is a virtualization product to…

How to Block IP Address in cPanel

How to Block IP Address in cPanel

In this article, we will explain how to block IP addresses Via cPanel. Follow the…

What is an SPF record?

The SPF (Sender Policy Framework) record is the equivalent of a TXT record that determines…