wget
- download files from the web. It supports HTTP , HTTPS , and FTP protocols, as well as retrieval through HTTP proxies. It is non-interactive.
Syntax
Options
Common Option |
description |
-O, --output-document=FILE |
write documents to FILE |
-c, --continue |
resume getting a partially-downloaded file |
-T, --timeout=SECONDS |
set all timeout values to SECONDS |
-b, --background |
go to background after startup |
-q, --quiet |
turn off wget’s output |
-P prefix |
sets directory. default is . |
–help |
display help info |
Examples
Download a file
1
| wget https://github-media-downloads.s3.amazonaws.com/Octocats.zip
|
This will download Octocats.zip
Download a file to a specific directory
Download maven to /tmp directory
1
| wget http://mirror.reverse.net/pub/apache/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz -P /tmp
|
Display only
use -qO-
or -qO -
to print the result in standard output only
1
| wget -qO- https://jsonplaceholder.typicode.com/users
|
Specify file name
1
| wget -O github-octcats.zip https://github-media-downloads.s3.amazonaws.com/Octocats.zip
|
This will download file and rename file to be github-octcats.zip
Resume a partially downloaded file
1
| wget -c https://github-media-downloads.s3.amazonaws.com/Octocats.zip
|
This will resume a partially downloaded file
Set timeout
1
| wget -T 2 https://github-media-downloads.s3.amazonaws.com/Octocats.zip
|
Reference