wget

Wget Cheatsheet #

wget is a command-line utility for downloading files from the web. It supports various protocols and options.

Basic Commands #

Command/OptionExampleDescription
wget <url>wget http://example.com/file.txtDownload the file from the URL
wget -O <file> <url>wget -O myfile.txt http://example.com/file.txtSave the file to a specific location
wget -P <dir> <url>wget -P /path/to/dir http://example.com/file.txtDownload the file and save it to a directory

Download Options #

Command/OptionExampleDescription
wget -r <url>wget -r http://example.com/Download the entire site recursively
wget -np <url>wget -np http://example.com/dir/Avoid ascending to the parent directory
wget -l <depth> <url>wget -l 2 http://example.com/Set recursion depth (e.g., 2 levels deep)
wget -nc <url>wget -nc http://example.com/file.txtDo not download files that already exist
wget -N <url>wget -N http://example.com/file.txtDownload only if the remote file is newer

Authentication #

Command/OptionExampleDescription
wget --user=<user> --password=<pass> <url>wget --user=user --password=pass http://example.com/Use HTTP basic authentication
wget --auth-no-challenge --user=<user> --password=<pass> <url>wget --auth-no-challenge --user=user --password=pass http://example.com/Use HTTP authentication without challenge

Handling Output #

Command/OptionExampleDescription
wget -q <url>wget -q http://example.com/Quiet mode, no output
wget -v <url>wget -v http://example.com/Verbose mode, detailed output
wget --append-output <file> <url>wget --append-output log.txt http://example.com/Append output to a log file

Download Resumption #

Command/OptionExampleDescription
wget -c <url>wget -c http://example.com/file.txtContinue a partially downloaded file

Proxy Settings #

Command/OptionExampleDescription
wget -e use_proxy=yes -e http_proxy=<proxy> <url>wget -e use_proxy=yes -e http_proxy=http://proxy.example.com:8080 http://example.com/Use a proxy for the download

Additional Options #

Command/OptionExampleDescription
wget --limit-rate=<rate> <url>wget --limit-rate=200k http://example.com/file.txtLimit download rate (e.g., 200 KB/s)
wget --timeout=<seconds> <url>wget --timeout=30 http://example.com/Set connection timeout in seconds

This cheatsheet provides essential wget commands and options for downloading files from the web.

wget

Explore our comprehensive cheatsheets to enhance your knowledge and efficiency. Each cheatsheet provides detailed command options, examples, and descriptions to help you master various tools and technologies.