Linux wget Command: Download Files from URLs
wget is a GNU tool for downloading files from URLs such as HTTP, HTTPS, and FTP. It is useful for saving files from a server or resuming interrupted downloads.
What is the wget command?
By default, it saves to the current directory using the remote file name. -O specifies the desired output file, and -c resumes an interrupted download. It also has a recursive download feature, but since it can request many pages, you should first check the scope and site policies.
Basic syntax
wget [options] URL
Installed implementations and options may vary depending on the distribution. Check the manual on your system with man wget.
Examples
Single file download
It saves to the current directory using the file name provided by the server.
wget https://example.com/
Specifying a file name
After confirming the possibility of overwriting an existing file, decide the save path.
wget -O example.html https://example.com/
Resume Interrupted Files
If the server supports range requests, it resumes at the end of the existing file.
wget -c https://example.com/archive.tar.gz
What should we check after downloading?
wget -O saves the received content to the specified filename. Depending on the server and network conditions, the progress or HTTP status messages may be displayed on standard error.
wget -O example.html https://example.com ls -lh example.html
The second command shows the name and size of the file if it has been created. Size and content may vary each time you request, so don’t expect a fixed byte count.
A download success message alone does not guarantee the authenticity of the file. If it is an official distribution file, separately verify the checksum or signature provided by the provider. If you run it again with the same name, -O can overwrite the existing file, so check the save path first.
Main Options and Format
| Options/Format | Description |
|---|---|
-O file |
Saves the download result to the specified file. |
-P directory |
Specifies the directory to save to. |
-c |
Resumes interrupted downloads when possible. |
-q |
Reduces progress messages. |
--spider |
Check the possibility of accessing a URL without saving the content. |
-r |
Recursively fetch linked resources. |
Precautions when using
-O can overwrite the specified file, so check existing data. When using -c, if the server file has changed, the resumed result can be corrupted, so checksum verification is important. Large-scale -r operations may put a burden on the server, so check permissions and scope.
Frequently Asked Questions
Does using wget -c always safely resume downloads?
No. It depends on whether the server supports range requests and whether the remote file has changed. Verify the checksum of the completed file.
Official Documentation
The exact behavior of the options and differences by implementation can be found in the official wget documentation.









