Menu
×
   ❮   
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SASS VUE GEN AI SCIPY CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING BASH

Bash wget - The Non-Interactive Network Downloader

Using the wget Command

The wget command is used to download files from the web.

It's a powerful tool for downloading single files, entire websites, or even batch downloads.


Basic Usage

To download a file, use wget url:

Example

wget http://example.com/file.txt

Options

The wget command has options to change how it works:

  • -b - Run in the background
  • -q - Quiet mode (no output)
  • -r - Download directories recursively
  • -c - Continue getting a partially-downloaded file
  • --limit-rate - Limit download speed

Run in the Background

The -b option allows you to run wget in the background.

This is useful for long downloads that you don't want to monitor continuously.

Example: Run in the Background

wget -b http://example.com/file.txt

Quiet Mode

The -q option allows you to run wget in quiet mode.

This is useful for scripts or automated tasks where output is not needed.

Example: Quiet Mode

wget -q http://example.com/file.txt

Recursive Downloads

The -r option allows you to download directories recursively.

This is useful for downloading entire websites or directories.

Example: Recursive Downloads

wget -r http://example.com/directory/

Continue Getting a Partially-Downloaded File

The -c option allows you to continue downloading a file that was partially downloaded. This is useful for resuming interrupted downloads.

Example: Continue Download

wget -c http://example.com/largefile.zip

Limit Download Speed

The --limit-rate option allows you to limit the download speed. This is useful for managing bandwidth usage.

Example: Limit Download Speed

wget --limit-rate=200k http://example.com/file.txt

Understanding Wget Output

The output of the wget command can vary depending on the options used. Here are some common elements:

  • Download Progress: Shows the progress of the download.
  • File Size: The size of the file being downloaded.
  • Download Speed: The speed at which the file is being downloaded.
  • Time Remaining: Estimated time remaining for the download to complete.

Batch Downloads

Wget can be used for batch downloads. For example, wget -r http://example.com/directory/ downloads all files in a directory.

Example: Batch Downloads

wget -r http://example.com/directory/


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2025 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.