Networking

wget

Network downloader for retrieving files via HTTP, HTTPS, and FTP.

#networking #download #http

Basic Download

Download a file.

wget [url]

Save with Different Name

Save file with a specific name.

wget -O filename.ext [url]

Resume Download

Resume an interrupted download.

wget -c [url]

Download in Background

Run download in background.

wget -b [url]

Limit Download Speed

Limit bandwidth (e.g., 200k = 200 KB/s).

wget --limit-rate=200k [url]

Download Multiple Files

Download URLs from a file (one URL per line).

wget -i urls.txt

Mirror Website

Download entire website for offline viewing.

wget --mirror --convert-links --adjust-extension --page-requisites --no-parent [url]

Options explained:

  • --mirror: Enable mirroring
  • --convert-links: Convert links for local viewing
  • --adjust-extension: Add proper extensions
  • --page-requisites: Download CSS, images, etc.
  • --no-parent: Don't ascend to parent directory

Download Recursively

Download with depth limit.

wget -r -l 2 [url]

Authentication

Basic authentication.

wget --user=username --password=password [url]

User Agent

Set custom user agent.

wget --user-agent="Mozilla/5.0" [url]

Retry Options

Set number of retries.

wget --tries=10 [url]

Infinite retries.

wget --tries=0 [url]

Download to Directory

Save to specific directory.

wget -P /path/to/directory [url]

Quiet Mode

Suppress output.

wget -q [url]

FTP Download

Download from FTP server.

wget ftp://ftp.example.com/file.zip

With authentication:

wget --ftp-user=username --ftp-password=password ftp://ftp.example.com/file.zip