$ wget -N --http-user=anonymous --http-password= https://svn.projectes.lafarga.cat/svn/iceupc/SambaSobreLDAP/slapd.conf
$ wget -r -N --no-parent http://193.144.12.8/pub/softcatala/
El no-parent és útil per a a que no segueixi els enllaços a directoris pare de servidors FTP o pàgines HTTP amb fitxers.
Automatitzar amb cron:
Es pot afegir l'opció de log:
$ wget -r -N --no-parent http://193.144.12.8/pub/softcatala/ -o fitxerdelog.txt
Vegeu també:
$ cd /var/www/virtualbox $ wget -r -N -nH --cut-dirs=1 --no-parent http://download.virtualbox.org/virtualbox/debian/
Amb cut-dirs crea la carpeta debian directament a /var/www/virtualbox.
Per automatitzar el mirror amb cron:
$ sudo cat /etc/cron.d/update_mirror_virtualbox 0 4 * * * sergi cd /var/www/virtualbox;wget -r -N -nH --cut-dirs=1 --no-parent http://download.virtualbox.org/virtualbox/debian/ -o /home/sergi/backup/VirtualBoxMirror.log
$ sudo wget -np --mirror -p --html-extension --convert-links http://agora.xtec.cat/iesmontsia/intranet
Descargar una página web o un fichero:
wget http://www.servidor.com/fichero.zip
2.Guardar la información que aparece por pantalla en un fichero de log:
wget -o log.txt http://www.servidor.com/fichero.zip
3.Para obtener más información sobre la descarga:
wget -d http://www.servidor.com/fichero.zip
4.Para que haga la descarga sin mostrar ningún log:
wget -q http://www.servidor.com/fichero.zip
5.Descargar las URLs que aparezcan en un fichero:
wget -i urls.txt
6.Continuar una descarga que se cortó:
wget -c http://www.servidor.com/fichero.zip v
7.Descargar algo que requiere usuario y clave:
wget –http-user=usuario –http-passwd=clave http://www.servidor.com/fichero.zip
8.Aparentar ser un navegador distinto:
wget --user-agent=Opera http://www.servidor.com/fichero.zip
9.Descargar una página con todos los elementos gráficos, javascript, etc:
wget -p http://www.servidor.com
10.Descargar toda una web:
wget -r http://www.servidor.com
11.Descargar hasta tres niveles de profundidad de una web:
wget -r –level=2 http://www.servidor.com
12.Descargar un archivo de un ftp:
wget ftp://ftp.servidor.com/fichero.zip
Bien, ¿y cómo podemos descargar algo muy grande siempre que nos apetezca?. Para mayor comodidad primero crearemos un directorio para albergar todas nuestras descargas:
mkdir descargaswget
Y entramos en él:
cd descargaswget/
Ahora creamos un archivo con nuestro editor favorito:
nano archivo
Y dentro del mismo escribimos lo siguiente:
wget -c www.servidor.com/archivoquenosqueremosbajar
Lo siguiente es hacerlo ejecutable:
chmod +x archivo
Y siempre que queramos seguir bajándolo, entraremos en el directorio que hemos creado y lo ejecutaremos:
./archivo
Él solito sé lo ira bajando y detectando la cantidad de fichero que ya se ha bajado, finalizando la descarga cuando lo haya bajado todo. E incluso podemos escribir dentro del archivo una lista de cosas a bajar, cuando ejecutemos el archivo el mismo ira mirando por el principio de la lista viendo si ya se han bajado los primeros elementos. Este es un claro ejemplo de como no necesitamos programas gráficos para desenvolvernos por internet.
Store local browsable version of a page to the current dir
(cd cmdline && wget -nd -pHEKk http://www.pixelbeat.org/cmdline.html)
Continue downloading a partially downloaded file
wget -c http://www.example.com/large.file
Download a set of files to the current directory
wget -r -nd -np -l1 -A '*.jpg' http://www.example.com/dir/
FTP supports globbing directly
wget ftp://remote/file[1-9].iso/
Process output directly
wget -q -O- http://www.pixelbeat.org/timeline.html | grep 'a href' | head
Download url at 1AM to current dir
echo 'wget url' | at 01:00
Do a low priority download (limit to 20KB/s in this case)
wget --limit-rate=20k url
Check links in a file
wget -nv --spider --force-html -i bookmarks.html
Efficiently update a local copy of a site (handy from cron)
wget --mirror http://www.example.com/
ESpecificar un usuari i una contrasenya web:
$ wget -O - --http-user=ken96 --http-passwd=1dc0c84a28 'http://dynamic.zoneedit.com/auth/dynamic.html?host=cerdanyola.guifi.net'
$ wget http://checkip.dyndns.org/ # cat index.html <html><head><title>Current IP Check</title></head><body>Current IP Address: 213.97.30.37</body></html> $ traceroute www.google.com traceroute to www.google.com (209.85.227.103), 30 hops max, 40 byte packets 1 192.168.0.5 (192.168.0.5) 0.739 ms 0.734 ms 0.794 ms 2 34.Red-213-97-30.staticIP.rima-tde.net (213.97.30.34) 41.524 ms 42.584 ms 41.240 ms 3 226.Red-81-46-33.staticIP.rima-tde.net (81.46.33.226) 42.051 ms 40.875 ms 41.609 ms ...
Consulteu també l'article IP.
$ wget -O - --post-data="mac=00:22:15:7c:62:9a" "http://192.168.7.182/fog/service/hostlookupbymac.php"
Consulteu un exemple a #Proxy.
NOTA: Consulteu també Configuració_de_clients_proxy#wget i http_proxy
Es pot configurar el proxy a:
$ sudo joe /etc/wgetrc ... # You can set the default proxies for Wget to use for http, https, and ftp. # They will override the value in the environment. https_proxy = http://proxy.aula3.informatica.iesebre.com:3128/ http_proxy = http://proxy.aula3.informatica.iesebre.com:3128/ ftp_proxy = http://proxy.aula3.informatica.iesebre.com:3128/ # If you do not want to use proxy at all, set this to off. use_proxy = on
Ara proveu:
$ sudo wget http://www.google.com --2010-09-10 13:19:07-- http://www.google.com/ S'està connectant a 172.16.0.1:3128... conectat. Proxy: Petició enviada, esperant resposta... 302 Moved Temporarily Localització: http://www.google.es/ [el següent] --2010-09-10 13:19:07-- http://www.google.es/ S'està connectant a 172.16.0.1:3128... conectat. Proxy: Petició enviada, esperant resposta... 200 OK Longitud: no especificat [text/html] Saving to: `index.html.6' ... 2010-09-10 13:19:08 (129 KB/s) - `index.html.6' saved [9024]
Per exemple:
$ wget --ftp-password=PASSWORD ftp://[email protected]/backup23012011.rsc