Wget is a free command-line utility for downloading files from the remote server. It supports HTTP, HTTPS, and FTP protocols, as well as follows the HTTP proxies servers.
The default wget download files under the current working directory. In this tutorial, we will describe you to how to download files to a specific directory using wget.
--output-document=FILE option will truncate FILE immediately, and all downloaded content will be written to FILE. Here the
wget -O FILE http://path is intended to work like
wget -O - http://path > FILE;
wget -O /tmp/Ubuntu.iso https://releases.ubuntu.com/20.04/ubuntu-20.04-desktop-amd64.iso
The above command will download the remote ISO file with the Wget command and save it as /tmp/Ubuntu.iso in the local system. No matter what is the current working directory.
--directory-prefix=PREFIX. Here the PREFIX is a directory where all other files and subdirectories will be saved to. The default download directory is “.” the current directory.
wget -P /tmp https://releases.ubuntu.com/20.04/ubuntu-20.04-desktop-amd64.iso
The above command will download the iso file under the
In this guide, you have learned two methods to download files to a specified directory using the Wget command.