Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
Command Line

How to Download Files with cURL: Commands and Examples

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use curl -o FILE URL to download a response body to a chosen filename, or curl -O URL to save it under the filename in the URL path. Add -L when the address redirects; use -C - with -o to resume a supported interrupted download. The examples below cover safe naming, authentication, multiple files, and common problems.

Choose where the download goes

By default, curl URL writes the response body to standard output (the terminal). That is useful for text, but binary content such as an archive or image should normally be saved to a file instead. There are two main output options: choose a local name yourself with -o, or let curl derive one from the URL path with -O.

Save to a specific filename with -o

Use this when you want a predictable destination, or when the URL is a route or query string rather than a useful filename:

curl -o report.zip 'https://example.com/download?id=42'

The value after -o is the local path to write. It can include a directory, provided that directory already exists and is writable. Quote URLs that contain shell-special characters such as &, so the shell passes the whole URL to curl as one argument.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Lexar D40E 128GB Dual USB 3.2 Gen 1 Type-C Jump Drive, Champagne Silver
  • USB-C 2-in-1 storage OTG: The Lexar JumpDrive Dual Drive D40E features USB Type-A and Type-C connectors in a slim, portable form factor for easy device compatibility
  • Transfer speeds up to 100MB/s: Based on internal testing, performance may vary depending upon the host device, interface, and usage conditions. 1MB=1,000,000 bytes
  • Plug and Play: Widely compatible with USB Type-C smartphones, tablets, laptops, Macs, and traditional Type-A devices, no software installation required. The 360° swivel design allows for easy switching between connectors without the hassle of losing a cap
  • Durable & Compact: The Lexar D40E USB memory stick features a metal enclosure, withstands temperatures from 0° to 50° C (32°F to 122°F), and is lightweight at 26g with dimensions of 70.4 x 16.9 x 11.7mm
  • Security & Warranty: Securely protects files using an advanced security software solution with 256-bit AES encryption. Backed by a Lexar 3-year limited warranty

Use the filename from the URL with -O

curl -O https://example.com/releases/app-1.2.3.tar.gz

Uppercase -O uses the final file component of the URL path and saves in the current working directory. It does not choose a destination directory for you. Check the working directory and any existing file before running it: a download may overwrite a file with the same name.

For a download URL such as https://example.com/download?id=42, -O is often a poor choice because the path does not identify a useful local filename. Prefer -o report.zip in that case.

Follow redirects when a download URL points elsewhere

Some addresses respond by redirecting the client to another URL. Add -L (also written --location) to tell curl to follow HTTP redirects:

curl -L -o latest.zip https://example.com/latest

To inspect response headers while diagnosing a redirect, add -i (also written --include):

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -i -L -o latest.zip https://example.com/latest

Headers are useful for seeing status and response details, but -i includes them in the output stream. For routine file downloads, omit it so the saved file contains only the response body. If the result is unexpected, inspect the headers and confirm that the final response is the file you intended to receive.

Rank #2
KOOTION USB C Flash Drive 32GB 2 in 1 OTG USB 3.0/Type C Thumb Drive Dual Drive USB C Memory Stick for Smartphone Laptop Tablet PC, Blue
  • 2 in 1: USB C + USB 3.0, 32GB usb c flash drive has dual ports, usb 3.0 port is applied to all devices which have usb 3.0 interface and usb c port is widely used in all Android smartphones with OTG function
  • High Speed USB 3.0: Read speed up to 90 MB/s, Write speed up to 30 MB/s, the speed of USB 3.0 interface is faster than USB 2.0, save time to wait, increases work productivity. Note: Speed will be limited if you use the USB key in the USB 2.0 interface
  • Large Compatibility: The USB 3.0 Connector is compatible with USB 3.0 & USB 2.0 backward USB 1.1 devices, such as Laptop, Desktop, Car Audio, Tablet, TV, Speakers, Projector. USB-C port is compatible with all Android Smartphones
  • Expand Storage: Good performance in storing, transferring and sharing digital data with families, friends, colleagues, customers. It can expand the capacity of smartphone, you can watch movies or share pictures when you go on vacation with your family
  • Note: Make sure your smartphone is equipped with OTG function and need to open OTG function in Settings when you plug memory stick, then you can transfer easily data bewteen different devices

Resume an interrupted download

To continue a partially downloaded file, use -C - with an explicit destination. The dash tells curl to determine the resume offset from the existing local file and the remote resource:

curl -C - -o large.iso https://example.com/large.iso

Resume is conditional: the server and protocol must support the operation. If curl reports that it cannot resume, do not assume the existing partial file is complete or valid. Check the error, then restart the download without -C - if that is appropriate:

curl -o large.iso https://example.com/large.iso

Use the same local filename when resuming. A different destination will not refer to the partial file you meant to continue.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Download files that require authentication

HTTP username and password

Use -u USER[:PASSWORD] to supply credentials. Providing only the username prompts curl to ask for the password, rather than placing the password directly in the command:

curl -u alice -o private.zip https://example.com/private.zip

A password written directly in a command can be retained in shell history or exposed to other users or tools that can inspect process arguments. Prefer the prompt when practical. Use HTTPS and verify the host before entering credentials.

Rank #3
Lexar D40E 64GB Dual USB 3.2 Gen 1 Type-C Jump Drive, Champagne Silver
  • USB-C 2-in-1 storage OTG: The Lexar JumpDrive Dual Drive D40E features USB Type-A and Type-C connectors in a slim, portable form factor for easy device compatibility
  • Transfer speeds up to 100MB/s: Based on internal testing, performance may vary depending upon the host device, interface, and usage conditions. 1MB=1,000,000 bytes
  • Plug and Play: Widely compatible with USB Type-C smartphones, tablets, laptops, Macs, and traditional Type-A devices, no software installation required. The 360° swivel design allows for easy switching between connectors without the hassle of losing a cap
  • Durable & Compact: The Lexar D40E USB memory stick features a metal enclosure, withstands temperatures from 0° to 50° C (32°F to 122°F), and is lightweight at 26g with dimensions of 70.4 x 16.9 x 11.7mm
  • Security & Warranty: Securely protects files using an advanced security software solution with 256-bit AES encryption. Backed by a Lexar 3-year limited warranty

SFTP with an SSH key

For an SFTP URL, curl can use an SSH private key. This example supplies the username, specifies a key file, and writes the remote file to a chosen local name:

curl -u username: --key ~/.ssh/id_rsa -o file.txt sftp://example.com/path/file.txt

The empty value after username: leaves the password empty; key authentication is provided separately. A private key may itself require a passphrase. Keep the key and any passphrase private, and confirm that the installed curl build supports the protocol and options you need.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Download more than one file

Pass multiple URL and output pairs in one curl invocation. With -O, each URL uses its URL-path filename:

curl -O https://example.com/a.txt -O https://example.com/b.txt

For explicit local names, associate an output option with each URL:

curl https://example.com/a.txt -o a-local.txt 
     https://example.com/b.txt -o b-local.txt

Without a parallel option, transfers run sequentially. Use --parallel when concurrent transfers suit the server and network; concurrency can increase load on both ends, so it is not automatically faster or more appropriate. Assign an output destination for each response unless using the remote-name behavior.

Rank #4
2-Pack 128GB USB C Flash Drive Dual Type C + USB A Memory Stick Jump Drive 2-in-1 Thumb Drive for Storage and Backup (128GB*2 Black&Blue)
  • 2-in-1 Dual Design: Features both USB-C and USB-A connectors, making it compatible with phones, tablets, MacBooks, PCs, and laptops-no adapter needed
  • Wide Compatibility: Works seamlessly with USB A and USB C devices, ensuring reliable file transfers across smartphones, computers, and more
  • Ample Storage Options: Available in 16GB/32GB/64GB/128GB providing plenty of space for photos, videos, music, and documents
  • Portable & Lightweight: Compact and durable design for travel, school, or daily use-take your files anywhere
  • Plug-and-Play Convenience: No software or drivers required; simply insert into USB-C or USB-A ports and start transferring files instantly

Read URLs from a file on curl 8.13.0 or newer

Newer curl versions document URL-list input with one full URL per line:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl --url @urls.txt

This form, including its implicit remote-name behavior, is documented beginning with curl 8.13.0. Check the installed version before relying on it:

curl --version

On older versions, use multiple URL arguments directly or a shell loop that safely reads one URL at a time. Treat the list as input, not executable shell content; do not paste untrusted command substitutions into a command.

Check the local curl version and supported protocols

curl is a command-line tool for transferring data to or from a server using URLs, but the capabilities available depend on the installed version and build. A command documented for a newer release may not work on an older installation, and protocol support can vary. Start with:

curl --version

For option details installed with your copy of curl, consult curl --manual or the local man page. This matters particularly for newer conveniences such as URL-list input, and when using FTP, FTPS, SFTP, or SCP rather than HTTP or HTTPS.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Samsung Type-C USB Flash Drive 256GB, USB 3.2 Gen 1, Up to 400MB/s
  • USB-C STORAGE ON THE GO: This sleek drive is supported by Samsung NAND flash and is incredibly compact to fit in the palm of your hand; Count on reliable performance and fast transfer speeds while staying compact
  • PERFORMANCE WITH SPEED: No need to choose between performance and reliability; Experience a fast, powerful flash drive that transfers 4GB files in just 11 seconds with up to 400MB/s USB 3.2 Gen 1 read speeds and is backward compatible with USB 3.0/2.0
  • MODERN MEETS ICONIC: The ultra-sleek USB-C drive looks as good as it performs; Featuring a reversible plug, the Type-C inserts into your devices seamlessly every time; Transfer large files with style and ease
  • ALWAYS CONNECTED: USB-C is compatible across devices, including laptops, tablets, phones and cameras, with enough space for 63,730 photos or maximum 12 hours of 4K video; With up to 256GB of storage space, this pocket-sized thumb drive comes in handy wherever you go
  • TOUGH & TRUSTED: Files stay secure, no matter the terrain; Samsung's flash memory technology makes the Type-C a trustworthy drive to store your valuable data; It's waterproof, shock-proof, magnet-proof, temperature-proof, and X-ray-proof body, plus it's backed by a 5-year limited warranty
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Common download problems and fixes

  • The terminal fills with unreadable characters: curl wrote the response body to standard output. Use -o filename or -O for binary files.
  • The file is an error page or the endpoint did not complete the download: the address may redirect. Try -L; use -i -L to inspect status and headers while troubleshooting. Check that the final response is the expected file.
  • The saved filename is wrong or unhelpful: -O derives the name from the URL path. Choose a name with -o filename, especially for URLs with query parameters.
  • Resume fails: not every server or protocol supports resuming. Review curl’s error rather than assuming the partial file can be continued; retry without -C - when a fresh download is appropriate.
  • Authentication fails: verify the host, username, credential type, and protocol. For HTTP password entry, try -u username so curl prompts; for SFTP key authentication, check the key path and whether the key needs a passphrase.
  • An option or protocol is unavailable: check curl --version and the installed manual. Version and build differences can affect newer options and protocol support.
  • The URL behaves strangely in the shell: quote URLs containing characters such as &. Never run untrusted shell substitutions as part of a download command.

Reliability, performance, and safe handling

For a reliable download command, decide the local filename first, follow redirects when the endpoint uses them, and use resume only when the remote side supports it. Multiple URLs run sequentially by default; --parallel can run transfers concurrently, but consider the server and network before increasing simultaneous work. For a one-off transfer, keep the command simple rather than adding options you do not need.

Prefer HTTPS, especially when credentials are involved, and verify the expected hostname before sending them. Treat downloaded archives and executables as untrusted until you verify them with a checksum or signature published by the file’s publisher. No particular file checksum is implied by these examples.

Or skip the browser setup

For a website screenshot rather than a general-purpose file download, ScreenshotNeo is a GET API that returns a screenshot as PNG, JPEG, or WebP, or a PDF. It is a different job from downloading an arbitrary file with curl. The following command saves a screenshot response to a local file; replace the example target URL with the page you want to capture. See the ScreenshotNeo documentation for request options.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
  • Cookie and consent banners are accepted before capture, and 60+ known consent platforms, newsletter popups, and chat widgets are removed; each step can be turned off.
  • Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed. The response includes X-Page-Verdict and X-Billed headers.
  • An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients.
  • The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo and get 1,000 free screenshots a month, with no card required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently Asked Questions

Can I use curl to save a response that is not a file download?

Yes. curl transfers response data from a URL; if you save it with an output option, the response body is written to that destination. The examples here are aimed at file downloads, so confirm that the endpoint actually returns the content you want.

Does resuming guarantee the final file is intact?

No. A successful transfer or resume does not by itself verify a file’s integrity. Compare it with a checksum or signature provided by the publisher when one is available.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.