
curl and its successor wget2. The current GNU Wget series is 1.25.The wget downloads files from the terminal and — the feature that made it irreplaceable — resumes interrupted downloads. Anyone who has lost a 2 GB ISO near the end of the progress bar on a bad connection knows why this matters. It remains the right tool for scripts, servers without a graphical interface, and unreliable connections.
Where it came from
wget was born in 1995 as Geturl, written by Hrvoje Nikšić. The name changed when the author learned of an Amiga program with the same name, and the W came from World Wide Web. It is part of the GNU Project, is written in portable C, and speaks HTTP, HTTPS, and FTP.
It filled a real gap at the time: there was no single reliable program that downloaded over HTTP and FTP without depending on Perl. And in an era of dial-up connections and slow university links, surviving a network drop without human intervention was the feature, not a detail.
A historical footnote: in 2010, analyst Chelsea Manning used wget inside the SIPRNet network to download the 250 thousand diplomatic cables from the Net-Centric Diplomacy database, later handed to WikiLeaks. The Iraq and Afghanistan war records, often mentioned in the same sentence, came through a different route — they were exported directly from the CIDNE system, without wget. The tool is neutral; its use is not always so.
The basics
# baixa um arquivo no diretorio atual
wget https://exemplo.com/arquivo.iso
# -c retoma de onde parou, se o arquivo ja existir parcialmente
wget -c https://exemplo.com/arquivo.iso
# salva com outro nome
wget -O ubuntu.iso https://exemplo.com/arquivo.iso
# salva em outro diretorio
wget -P ~/Downloads https://exemplo.com/arquivo.iso
# baixa em segundo plano, com log em wget-log
wget -b https://exemplo.com/arquivo-grande.iso
The -c is the reason the command exists. It tells the server to continue from the byte where the local file stopped instead of starting over. It works if the server supports partial requests — almost all do.
A caveat almost nobody mentions: -c assumes that the local file with that name is the beginning of the remote file. If some other file with the same name is there, it requests the remainder starting at that size and appends it to what already exists — the result has the right size, corrupted contents, and no warning. Resume only what you started yourself.
When the network is bad
# tenta indefinidamente, com espera crescente de ate 30s entre tentativas
wget -c --tries=0 --waitretry=30 https://exemplo.com/arquivo.iso
# desiste de uma tentativa que travar por mais de 30s
wget -c --timeout=30 --tries=20 https://exemplo.com/arquivo.iso
# limita a banda, para nao engasgar a conexao da casa ou do escritorio
wget --limit-rate=500k https://exemplo.com/arquivo.iso
About --waitretry: it is not a fixed interval, it is a ceiling. wget waits 1 second after the first failure, 2 after the second, and so on up to the value you provided. The default is already 10 seconds, so --waitretry=10 changes nothing — it is only worth specifying to increase it. The --tries also already defaults to 20; --tries=0 is what means infinite.
The --limit-rate is underrated: on a shared server, downloading at full speed hurts everyone's latency. Capping at 500 KB/s is often the difference between a considerate download and a support ticket.
Multiple files at once
# um arquivo de texto com uma URL por linha
wget -i lista-de-urls.txt
# continuando e limitando a banda, para uma lista grande
wget -c --limit-rate=1m -i lista-de-urls.txt
# todos os PDFs de uma pagina, sem subir de diretorio
wget -r -l 1 -np -A pdf https://exemplo.com/documentos/
In the last one, every flag matters: -r is recursive, -l 1 limits depth to one level, -np (no-parent) prevents it from climbing to the parent directory, and -A pdf accepts only PDFs. Without -np and without -l, a recursive download can end up downloading the entire site.
Mirroring a website
# baixa uma pagina com tudo que ela precisa para abrir offline
wget -p -k https://exemplo.com/artigo.html
# espelho completo do site, navegavel offline
wget --mirror -p -k -P ./copia https://exemplo.com/
-p fetches the page's images, CSS, and scripts; -k converts links to point to local files; --mirror is equivalent to -r -N -l inf --no-remove-listing — infinite recursion with timestamp checking.
Two courtesies that prevent blocking: use --wait=1 to avoid hammering the server, and respect robots.txt. There is -e robots=off, but ignoring the site's policy is your decision and often results in an IP block.
Headers, authentication, and certificates
# identificar-se como um navegador
wget -U "Mozilla/5.0" https://exemplo.com/arquivo
# enviar um cabecalho (ex.: token de API)
wget --header="Authorization: Bearer SEU_TOKEN" https://api.exemplo.com/dados
# autenticacao HTTP basica
wget --user=usuario --ask-password https://exemplo.com/privado/arquivo
On forums, you will find suggestions to use --no-check-certificate when an SSL error occurs. It disables certificate verification and opens the way to interception. Certificate errors almost always mean the system clock is wrong or the CA package is outdated — fix the cause (sudo apt install --reinstall ca-certificates) instead of disabling the check.
wget or curl?
Both download files, but solve different problems:
- wget wins for downloads: resumes automatically, is recursive, mirrors sites, and keeps trying when the network drops. It is the tool for fetching files.
- curl wins for APIs: speaks many more protocols, builds complex requests, sends data, and naturally prints to standard output — it fits into pipes. It is the tool for talking to services.
wget -O - https://exemplo.com/script.sh | less # wget imprimindo na saida
curl -L -O https://exemplo.com/arquivo.iso # curl salvando com o nome remoto
Notice -L in curl: it does not follow redirects by default, whereas wget does. This is the most common trap when swapping one for the other in a script.
And wget2
The GNU Project maintains wget2, rewritten with parallel downloads, HTTP/2 support, and compression — much faster on sites with many small files. Where packaged, it installs alongside without conflicts, using the binary wget2:
sudo apt install wget2
wget2 --version
The installed version varies considerably, though — check before relying on a new feature:
wget --version | head -1
Ubuntu 24.04 LTS ships 1.21.4; Debian 13 ships 1.25.0. And there is one case that breaks the assumption: on Fedora, since version 40, the command wget is already wget2 — the classic package was retired and replaced. Where both coexist (Debian, Ubuntu), wget2 installs alongside wget without conflict. Fedora's replacement proposal itself records the successor's gaps: except for WARC and FTP, it is compatible.
Check the download before using it
Downloading over an unstable connection with resuming, then writing straight to a USB drive without checking, is the quickest way to lose an afternoon to an installation that fails midway. Every distribution publishes a checksum file alongside the image:
wget https://exemplo.com/SHA256SUMS
wget https://exemplo.com/imagem.iso
sha256sum -c SHA256SUMS --ignore-missing
# imagem.iso: SUCESSO
The --ignore-missing avoids errors for other images listed in the file that you did not download. If the output says FAILED, the download is corrupted — delete it and download again, without -c.
To keep going
- Using the dd command — to write the ISO you just downloaded to a USB drive
- 500 Linux commands
- Official GNU Wget manual