<\/span><\/h2>\n\n\n\nBefore starting, you need to connect to your server via SSH as the root user or as any other user with sudo privileges.<\/p>\n\n\n\n
To connect to your server as the root user, use the following command:<\/p>\n\n\n\n
ssh root@IP_ADDRESS -p PORT_NUMBER<\/pre>\n\n\n\nMake sure to replace IP_ADDRESS<\/code> and PORT_NUMBER<\/code> with your actual server IP address and SSH port number. The default port number is 22, so try that one first if you’re not sure.<\/p>\n\n\n\nOnce logged in, make sure that your server is up-to-date by running the following commands:<\/p>\n\n\n\n
apt-get update -y<\/pre>\n\n\n\nOr<\/p>\n\n\n\n
yum update -y<\/pre>\n\n\n\nNow that everything is up to date, we can install Wget and see how to use it.<\/p>\n\n\n\n
<\/span>Install Wget<\/span><\/h2>\n\n\n\nBy default, the Wget package comes pre-installed in most Linux operating systems. If not installed, you can install it using either the APT or YUM command-line utility (depending on your Linux distribution).<\/p>\n\n\n\n
For RHEL\/CentOS\/Fedora, install Wget by running the following command:<\/p>\n\n\n\n
yum install wget -y<\/pre>\n\n\n\nFor Debian\/Ubuntu, install Wget by running the following command:<\/p>\n\n\n\n
apt-get install wget -y<\/pre>\n\n\n\nOnce installed, you can verify the installed version of Wget command using the following command:<\/p>\n\n\n\n
wget --version<\/pre>\n\n\n\nOutput:<\/p>\n\n\n\n
GNU Wget 1.15 built on linux-gnu.\n<\/pre>\n\n\n\n<\/span>Download a Single File<\/span><\/h2>\n\n\n\nYou can use the Wget command without any options specified to download a file from the specified URL to your current working directory.<\/p>\n\n\n\n
For example, download this Drupal install file using the Wget command, as shown below:<\/p>\n\n\n\n
wget https:\/\/ftp.drupal.org\/files\/projects\/drupal-8.7.3.tar.gz<\/pre>\n\n\n\nYou should see the following screen:<\/p>\n\n\n\n
<\/figure><\/div>\n\n\n\nIn the above screen, you can see the progress bar, downloaded file size and download speed.<\/p>\n\n\n\n
<\/span>Download Multiple Files<\/span><\/h2>\n\n\n\nThe Wget command also allows you to download multiple files by specifying multiple URLs.<\/p>\n\n\n\n
For example, the following command will download Drupal and WordPress files:<\/p>\n\n\n\n
wget https:\/\/ftp.drupal.org\/files\/projects\/drupal-8.7.3.tar.gz https:\/\/wordpress.org\/latest.zip<\/pre>\n\n\n\nYou should see the following screen:<\/p>\n\n\n\n
<\/figure><\/div>\n\n\n\nIn some cases, you might want to download a large number of files. In this case, you can store all URL’s in a text file and download them using the -i<\/code> option.<\/p>\n\n\n\nFirst, create a text file using the following command:<\/p>\n\n\n\n
nano download.txt<\/pre>\n\n\n\nAdd all the URL’s that you want to download:<\/p>\n\n\n\n
https:\/\/ftp.drupal.org\/files\/projects\/drupal-8.7.3.tar.gz \nhttps:\/\/wordpress.org\/latest.zip\n<\/pre>\n\n\n\nSave and close the file.<\/p>\n\n\n\n
Next, use the Wget command with the -i<\/code> option to download all files:<\/p>\n\n\n\nwget -i download.txt<\/pre>\n\n\n\nYou should see the following screen:<\/p>\n\n\n\n
<\/figure><\/div>\n\n\n\n