Download and Keep the File Name
curl -LO https://example.com/files/tool-1.2.3.tar.gz-O saves the file in the current folder under the name at the end of the URL. -L follows redirects, which many download links use. Without -L, you may save a short redirect page instead of the file.
Choose the File Name
curl -L -o tool.tar.gz https://example.com/files/tool-1.2.3.tar.gz
curl -L -o /opt/downloads/tool.tar.gz https://example.com/files/tool-1.2.3.tar.gzLowercase -o takes a name or a full path. The folder must exist and be writable, or curl stops with a write error.
Stop on Errors
curl -fLO https://example.com/files/tool-1.2.3.tar.gzBy default, curl saves whatever the server sends, including a "404 Not Found" page. -f makes curl fail on an HTTP error instead, with exit code 22, so a script can notice it. Add --retry 3 to try again after a temporary failure.
Resume an Interrupted Download
curl -L -C - -O https://example.com/images/disk.iso-C - tells curl to look at the partial file and continue from its end. The server must support range requests; most file servers do. For a very large download on a remote server, run it inside tmux or with nohup so a dropped SSH session does not stop it, and check free space first with df.
Several Files at Once
curl -LO https://example.com/a.tar.gz -O https://example.com/b.tar.gz
curl -L --remote-name-all https://example.com/a.tar.gz https://example.com/b.tar.gz
curl -LO "https://example.com/logs/app-[1-5].log"Each URL needs its own -O, or use --remote-name-all once. Square brackets download a numbered series; quote the URL so the shell does not interpret them. Adding -Z (curl 7.66.0 and later) downloads the files in parallel instead of one after another.
Limit Speed, Show Progress, Send a Header
| Option | Effect |
|---|---|
--limit- | Caps speed at 2 MiB per second. |
-# | Shows a progress bar. |
-sS | Silent, but shows errors. |
-H "Name: value" | Sends a request header. |
A private download often needs a token in a header:
curl -fLO -H "Authorization: Bearer YOUR_TOKEN" https://example.com/private/build.tar.gzA token typed on the command line is stored in your shell history. Remove it from there afterward, or read it from a variable that you set in a file only you can read.
Verify Before You Run Anything
Never pipe a download straight into a shell. If a file will be executed or installed, download it, check its checksum against the value the project publishes, and read scripts before running them:
curl -fLO https://example.com/files/tool-1.2.3.tar.gz
curl -fLO https://example.com/files/SHA256SUMS
sha256sum --check --ignore-missing SHA256SUMSThe last command prints OK next to each file that matches. If the project shows a single hash on its website instead:
echo "EXPECTED_SHA256 tool-1.2.3.tar.gz" | sha256sum --checkReplace EXPECTED_ with the published value; two spaces separate hash and name. For an install script, open it with less install.sh, check what it changes, and only then run it. If the project also signs its checksum file, verify the signature too.
Common Errors
- The file is tiny or contains HTML: a redirect or error page was saved. Add
-Land-f. - Exit code 23: curl could not write the file; check the folder's permissions and free space.
- Exit code 60, certificate problem: update the CA certificates package and check the server's clock. Do not turn off certificate checks with
-kas a fix.
curl or wget?
| curl | wget | |
|---|---|---|
| Saves by default | No, needs -O | Yes |
| Follows redirects | With -L | Yes |
| Resume | -C - | -c |
| Whole site copy | No | -r |
curl is better for APIs and headers; wget for mirroring folders. To copy files between your own machines, scp is simpler. Other connection tests with curl are in Linux network commands.
Updated:
Linux VPS with Full Root Access
MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.
More Guides
No Limits on Service or Support
You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

- 100% customer satisfaction goal
- Our own hardware
- 24/7 ticket and email support
- 4 countries with locations