Last Updated on
Insight: 9 Wget Command Examples In Linux For Beginners
Wget command in Linux is often considered as a Linux file downloader.
Wget is a command line utility in Linux to download files. In this tutorial post, we are going to see 11 different Wget command examples for beginners.
Useful Wget Command Examples In Linux For Beginners
Let’s start our tutorial by installing Wget in Ubuntu and Debian based operating system.
sudo apt install wget
sudo yum install wget
Basic Wget command syntax:
wget [OPTIONS] [URL]
Now, Let’s checkout the wget examples:
1. Download a file using wget command:
2. How to download and save the file with a different name using wget command:
wget -O newfilename.zip http://website.com/files/file.zip
The above command will download the file and will save the file with the different name. Here you can see the option -0 to save the file with a different file name.
3. How to download a file to a specific directory using the
wget command in Linux:
Run the wget command with the option -P:
wget -P /tmp/downloadfolder http://website.com/files/file.zip
Above command will download the file to /tmp/downloadfolder directory.
4. How to download multiple files using wget command in Linux:
Run the following command to download multiple files using wget command in Linux:
wget http://website1.com/file.zip http://website2.com/filename.zip
5. How to download multiple files by reading URL’s from TEXT file:
This is one of the interesting feature as you can download multiple files by storing several urls in a text file. You should use -i option to download the files from the website address stored in a text file:
wget -i itsubuntu.txt
6. Download file using FTP protocol:
Run the following command to download file using wget with FTP protocol:
wget --ftp-user=FTP_USERNAME --ftp-password=FTP_PASSWORD ftp://ftp.example.com/itsubuntu.txt
7. How to download file in the background using Wget command in Linux:
With the -b option with wget, you can start downloading the files in the background.
wget -b https://itsubuntu.com/linux.txt
8. How to resume uncompleted downloads:
Run the following command to resume the uncompleted download in Linux:
wget -c https://itsubuntu.com/linux.txt
9. Limit speed of download:
One of the interesting feature of wget as you can limit or control the speed of download in Linux with limit-rate option:
wget --limit-rate=50k https://itsubuntu.com/linux.txt