Download a File with curl -O
Grab a file straight to disk over HTTP(S), following redirects, with a single curl invocation.
Run curl -LO https://example.com/tool.tar.gz — -O keeps the remote filename and -L follows redirect links.
01Command
Command
$ curl -LO https://example.com/tool.tar.gz02What it does
-O saves the file under the name from the URL, while lowercase -o lets you choose your own name (curl -o myname.tar.gz URL). -L matters because most download links redirect to CDNs, and without it curl saves an HTML redirect page instead of the file. Unlike wget, curl is preinstalled almost everywhere, making it the default choice in scripts and one-off downloads.
03Risk
!Warning: curl writes the file as it streams — if the transfer fails midway you get a truncated file; re-run with -C - to resume or delete the partial file.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- curl(1) — Ubuntu man pageEvidence: Man page text includes -O/--remote-name and -L/--location (follow redirects), confirming the flags used in the command.
- curl(1) — Linux man pageEvidence: Documents -o/--output (write output to file) and -O/--remote-name (save with the remote filename part of the URL); both flags confirmed in page text.
Last verified: 2026-09-19 · Category: Network