The command
curl -fLO https://example.com/file.tar.gz
wget https://example.com/file.tar.gz
Equivalent commands
| Task | curl / wget |
|---|---|
| Save to a file | curl -O URL / wget URL |
| Print to the terminal | curl URL / wget -qO- URL |
| Choose the filename | curl -o name URL / wget -O name URL |
| Follow redirects | curl -L URL / wget does by default |
| Resume a download | curl -C - -O URL / wget -c URL |
| Send a header | curl -H "K: v" URL / wget --header="K: v" URL |
| POST data | curl -d "a=1" URL / wget --post-data="a=1" URL |
| Basic auth | curl -u user:pw URL / wget --user=user --password=pw URL |
| Show response headers | curl -i URL / wget -S URL |
| Limit speed | curl --limit-rate 1M URL / wget --limit-rate=1m URL |
Opposite defaults
Almost every difference you will notice comes from the defaults. Wget saves to a file, follows redirects and retries a failed download on its own. Curl prints to standard output, stops at a redirect and tries once. Neither is better; they reflect what each tool expects you to be doing. It does mean a command translated flag for flag behaves differently unless you add the missing defaults back.
What only one of them does
Wget can download recursively: follow the links in a page, fetch what they point to, and rewrite the links so the copy works offline. That makes it the tool for mirroring a site or grabbing every file in a directory listing. Curl has no equivalent.
Curl speaks far more protocols and gives precise control over a single HTTP request: any method, multipart uploads, client certificates, detailed timing with -w. It is also a library, libcurl, which is what many programming languages use underneath their HTTP clients. For calling an API, curl is the natural choice, and it is the format API documentation uses.
# mirror a documentation site for offline reading
wget --mirror --convert-links --page-requisites --no-parent https://example.com/docs/
# time each phase of a single request
curl -s -o /dev/null -w "dns %{time_namelookup}s connect %{time_connect}s total %{time_total}s\n" https://example.com/
Which to use
Downloading a file, especially a large one over a poor connection, or copying part of a site: wget, because its defaults already do the right thing. Testing an endpoint, sending anything other than a simple GET, or scripting against an API: curl. In a minimal container you often get only one of them, and for a plain download either works.
Common mistakes
- wget discards the body of an error response unless you add
--content-on-error, so the API's explanation of a 400 never reaches you. - wget cannot build a multipart upload. There is no equivalent of
curl -F. - BusyBox wget, common in small container images, supports only a fraction of GNU wget's options.
Related curl examples
Curl Download File Example
Curl prints what it downloads to the terminal unless told to save it.
Curl Flags Example
Curl has well over two hundred options.
How to Use Curl
Curl is a command-line program that makes network requests and prints what comes back.
Curl Follow Redirect Example
Curl does not follow redirects unless asked.
Postman vs curl
When a graphical client earns its place next to the command line.
All Curl Examples
49 worked examples, grouped by what you are trying to do.
More under Reference
References
- curl vs Wget — The comparison maintained by curl's author.
- GNU Wget manual — The official Wget reference.
These links leave api-tester.com, which is independent of the projects they point to.
FAQ
What is the difference between wget and curl?
Wget is a downloader: it saves to files, follows redirects, retries and can mirror sites recursively. Curl is a general transfer tool that prints to standard output and gives detailed control over individual requests.
Is curl or wget better for downloading files?
Wget needs fewer flags for a robust download because it retries and follows redirects by default. Curl does the same job with -L, -O and --retry added.
Can wget send a POST request?
Yes, with --post-data or --post-file, and --header for headers. It cannot send multipart form uploads.