Skip to content
shellmap

Download a file from a URL

Save a remote file to disk via HTTP/HTTPS, with progress and resume where supported.

How to download a file from a url in each shell

Bashunix
curl -O https://example.com/file.zip

`-O` writes to the URL's basename. Use `-o name.zip` for a custom output filename and `-L` to follow redirects.

Zshunix
curl -O https://example.com/file.zip
Fishunix
curl -O https://example.com/file.zip
PowerShellwindows
Invoke-WebRequest -Uri https://example.com/file.zip -OutFile file.zip

Aliased as `iwr`. `curl` in PowerShell 5/7 is an **alias for this cmdlet**, not the real `curl.exe`. Call `curl.exe ...` to force the binary.

cmd.exewindows
curl.exe -O https://example.com/file.zip

Windows 10 1803+ ships `curl.exe` in `C:\Windows\System32`. Older Windows: use `powershell -Command "Invoke-WebRequest ..."`.

Equivalents listed for Bash, Zsh, Fish, PowerShell, cmd.exe.

Gotchas & notes

  • `curl -O` derives the local filename from the **URL path**, not the `Content-Disposition` header. Use `curl -OJ` to honour the server-suggested filename.
  • To resume a partial download: `curl -C - -O ...` (bash) or `Invoke-WebRequest` + `-Resume` (PowerShell 7+).
  • PowerShell 5's `Invoke-WebRequest` is much slower than `curl.exe` and `wget` because it parses the response into a PowerShell HTML object — for large files always use `curl.exe` or `Start-BitsTransfer`.
  • For unattended scripts behind a corporate proxy, `curl` honours `$HTTP_PROXY` / `$HTTPS_PROXY`; `Invoke-WebRequest` needs `-Proxy` explicitly.

Related commands