Download files to your instance from a server

The wget command is used to download files from HTTP, HTTPS, or FTP servers. It is particularly useful for downloading files directly to your instance from a web server.

To upload files or directories to your instance, see our documentation on scp and rsync.

Basic syntax

Run the wgetcommand from an SSH session on your instance to download files:

$wget <URL_of_source_file>

Example

$wget https://www.example.com/index.html

This command downloads the file located at https://www.example.com/index.html to the current directory on your instance.

Commonly used options

Rename the downloaded file

To download the file under a different name, use the -O option:

$wget -O <desired_filename> <URL_of_source_file>

Example

Download index.html from https://www.example.com/ and save it as myfile.html:

$wget -O myfile.html https://www.example.com/index.html

Download to a different directory

To download a file to a directory on your instance other than the current one, specify the directory path with the -P option:

$wget -P <directory_path> <URL_of_source_file>

Example

Download index.html from https://www.example.com/ and save it to /home/ubuntu/:

$wget -P /home/ubuntu/ https://www.example.com/index.html

Download in background

To download a file in the background and continue running other commands, use the -b option:

$wget -b <URL_of_source_file>

Resume a download

To resume an interrupted download, use the -c option:

$wget -c <URL_of_source_file>

Limit download speed

To limit the download speed, use the --limit-rate option:

$wget --limit-rate=<rate> <URL_of_source_file>

Example

$wget --limit-rate=100k https://www.example.com/index.html

Additional resources

View the manual page (manpage) for wget online. Alternatively, enter man wget in a Linux terminal to view the manpage.