Skip to content

Wget cheatsheet

Basic usage

Download the URL


Concatenate the output and write to a single file

wget -O file

Ignore certificate errors

wget --no-check-certificate

Ignore robots.txt file

wget -e robots=off

Set maximum number of redirects

wget --max-redirect=number


Disable cookies

wget --no-cookies

Set custom cookie value

wget --no-cookies --header "Cookie: name=value"

Save cookies to file

wget --save-cookies cookies.txt

Load cookies from file

wget --load-cookies cookies.txt


Send additional HTTP header (can be specified multiple times)

wget --header='Custom-header: test'

Set referer

wget --referer=url

User agent

wget -U user-agent-string

Disable cache (send Cache-Control and Pragma headers with no-cache value)

wget --no-cache

Save headers at the beginning of the file

wget --save-headers


Define timeout of the request

wget -T 10

The -T combines all the options below:

  • --dns-timeout - DNS loookup
  • --connect-timeout - TCP connection
  • --read-timeout - idle time

Download files

Download all PDF files, ignore robots.txt file

wget -e robots=off -r -l1 -A.pdf -nd http://server

Mirror the website

wget --mirror --convert-links --adjust-extension --page-requisites --no-parent

or shorter version

wget -m -k -E -p -np